|
I recommend you to start with the printing section here in codeproject. There are a lot of articles that will give you info needed to start your programm. Then ask when you get a problem
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
i ve applied accessdeniedace on a process. When i trying to retrieve the Module file name of a window from that process using GetWindowModuleFileName(..), the functiun succeeds and it return the module file name of the calling process. how i can solve this problem ? is there any other way to get the module name of an hWnd ?
Thanks & Regards
|
|
|
|
|
nitin3 wrote: is there any other way to get the module name of an hWnd ?
Yep. the below code will do.
DWORD dwProcessId;<br />
GetWindowThreadProcessId( hWnd, &dwProcessId);<br />
HINSTANCE hModule = (HINSTANCE)GetWindowLong(hWnd, GWL_HINSTANCE);<br />
if(hModule == NULL)<br />
{<br />
return;<br />
}<br />
HANDLE hProcess = OpenProcess(PROCESS_VM_READ|PROCESS_QUERY_INFORMATION, FALSE, dwProcessId);<br />
if( hProcess == NULL )<br />
{<br />
return;<br />
}<br />
bool bReturn = GetModuleFileNameEx( hProcess, hModule, csLog.GetBuffer( MAX_PATH), MAX_PATH );<br />
csLog.ReleaseBuffer();
Where hWnd is the handle of any window
|
|
|
|
|
Thanks nave..
Thanks & Regards
|
|
|
|
|
Hi,
Iam read and write to external keyboard through serialport RS232.
My coding is
m_hComm = CreateFile(szPort, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING,
FILE_FLAG_OVERLAPPED, 0);
For Reading,
bResult = ReadFile(port->m_hComm,
&RXBuff, // RX Buffer Pointer
1, // Read one byte
&BytesRead,// Stores number of bytes read
&port->m_ov);
For Writing,
bResult = WriteFile(port->m_hComm,// Handle to COMM Port
port->m_szWriteBuffer strlen((char*)port->m_szWriteBuffer),// Length
&BytesSent,// Where to store the number of bytes sent
&port->m_ov);//Overlapped structure
THis is my coding. I can read the dats from serial port.
But while writing,it didnot write.
By having GetLastError(), I got the error as ERROR_IO_PENDING,
Whats the mistake..whats the meaning of this error.
Anu
|
|
|
|
|
Anu_Bala wrote: But while writing,it didnot write.
By having GetLastError(), I got the error as ERROR_IO_PENDING,
Because tou're doing overlapped IO, have a look at documentation http://msdn2.microsoft.com/en-us/library/ms686358.aspx[^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
How can I programatically un-select the item in the list (Report view) ?
Thank in advance
Somboon
|
|
|
|
|
xanagan666 wrote: How can I programatically un-select the item in the list (Report view) ?
call SetItemState() function
m_List.SetItemState( nItem, 0, LVIS_SELECTED );
if you know the item index to un-select, you can set that value to the nItem. if you set nItem as -1, all selected items will be unselected.
|
|
|
|
|
I just want to enumerate all the audio video devices installed on the machine.
|
|
|
|
|
Hi Everybody,
I have been trying to save a powerpoint slide from a win32 sdk application.
My Requirment is like this, From my application i need to open a powerpoint application using ole and then save the slides as bitmap .But this is not possible for me to use any mfc based application or active x control.
Can anybody please help me out in this case
Niloy
|
|
|
|
|
I want to do study about Pdf library. Can someone provide me the tutorial on Pdf library. Actually I need to study all the functions, read them what they do because I need to convert the bmp and text to pdf.
|
|
|
|
|
|
Actually I wanted to study Internal working of the CPDFlib. The functions used in that library.
|
|
|
|
|
Not too many images to add, about 20, I'm not sure if a thread is necesaay. Here is the piece of code, the performace is not good enough.
My CPU is P4 1.8G.
LPCITEMIDLIST pidl=SHBrowseForFolder(&bi);
if(::SHGetPathFromIDList(pidl,FindPath)) {
_tcscat(FindPath,TEXT("\\*.jpg"));
CFileFind ff;
BOOL b=ff.FindFile(FindPath);
while (b) {
b=ff.FindNextFile();
CString FilePath=ff.GetFilePath();
WCHAR *w=FilePath.AllocSysString();
Bitmap bm(w);
::SysFreeString(w);
HBITMAP hBmp;
bm.GetHBITMAP(Color::Black,&hBmp);
Bitmap *pThumb=(Bitmap*)bm.GetThumbnailImage(60,45);
pThumb->GetHBITMAP(Color::Black,&hBmp);
CBitmap *pBmp=new CBitmap;
pBmp->Attach(hBmp);
int i=m_wndToolDlgBar.m_ImgList.Add(pBmp,RGB(0,0,0));
m_wndToolDlgBar.m_piclist.InsertItem(0,ff.GetFileTitle(),i);
delete pThumb;
delete pBmp;
}
}
|
|
|
|
|
Well whats the problem? does speed low?
|
|
|
|
|
Yes, it freezes until all images are added.
|
|
|
|
|
You can use of timer for this work.
|
|
|
|
|
followait wrote: WCHAR *w=FilePath.AllocSysString(); Bitmap bm(w); ::SysFreeString(w); HBITMAP hBmp; bm.GetHBITMAP(Color::Black,&hBmp); Bitmap *pThumb=(Bitmap*)bm.GetThumbnailImage(60,45); pThumb->GetHBITMAP(Color::Black,&hBmp);
You can skip the above code if use the LoadImage() function instead of the GDI+ functions/classes
CString FilePath=ff.GetFilePath();<br />
HBITMAP hBitmap= (HBITMAP)LoadImage(....)<br />
CBitMap objBitmap( hBitmap );
|
|
|
|
|
|
If you dont need to jpg files and... and need to bmp you can use of LoadImage.
|
|
|
|
|
I am not sure, as i read you code, you seems first searching file and then updating the listctrl for every files, why don't you put all searched file in some datastructure and update teh list ctrl in single go instead of updating it for evry file and why there different handle for same image, you can use same handle for every image.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
Every image is considered different from each other. So no different handles for the same image.
I consider the "Go ahead way" as a optimization.
Maybe it will be done later, maybe not.
Thanks for you advice.
|
|
|
|
|
It seems you are doing two things in the while() loop. Why not separate the "add images to list" and "add items to control" into two while() loop? If that is not feasible, then you might want to consider a secondary thread for this so that the UI remains responsive.
Another thing to try would be to call SetRedraw(FALSE) before the "add items to the list" code.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Because by seprating, the mapping of file and image is a little hard to find when I forgot the code.
SetRedraw(FALSE) might be a good try.
Thanks for you suggestion.
|
|
|
|
|
this is part of my code.
and i am making some drawing line.
first, i put my left_mousebutton then point is displayed,
but the line don't draw~
it is good if i delete "WM_LBUTTONUP".
can you tell me why this happen?
HDC hdc;
PAINTSTRUCT ps;
static TCHAR str[200] ;
int len;
static int x = 100;
static int y = 100;
static bool b_start = false;
case WM_LBUTTONDOWN:
x = LOWORD(lParam);
y = HIWORD(lParam);
b_start = true;
return 0;
case WM_MOUSEMOVE:
if(b_start == true)
{
hdc = GetDC(hWnd);
MoveToEx(hdc, x, y, NULL);
x = LOWORD(lParam);
y = HIWORD(lParam);
LineTo(hdc, x, y);
ReleaseDC(hWnd, hdc);
}//b_start == true
case WM_LBUTTONUP:
b_start = false;
return 0;
}//iMessage
return (DefWindowProc(hWnd, iMessage, wParam, lParam));
}//LRESULT
Thank you everyone~
|
|
|
|