How to send HDC handler within message?

Is there some message which I could use to send a special message which should bear information about HDC handle to external Window? I have application to capture Window and I need to tell to the destination window where is should copy pixels. I tried to ise SC_MINIMIZE but his wParam has different type than HDC.
Last edited on
You can use PostMessage:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms644944%28v=vs.85%29.aspx


By the way: Did you solve the gdi stuff
That is not what I mean. I ask which message can I use? I send messages with function like
SendMessage(HWindow, SC_MINIMIZE, 0, 0);
But I need to fill the wparam or lparam with handler (HDC). Problem is that when sending SC_MINIMIZE message, I cannot send
SendMessage(HWindow, SC_MINIMIZE, HDC, 0);
because it expects different type. So I need some message which will pass through the WindowProc but will be able to keep the handle....

To answer your question. We found that PrintWindow() with WM_PRINTCLIENT doesn't work. There is not any message WM_PRINTCLIENT recieved by the external app. There is message WM_NCPAINT instead of WM_PRINTCLIENT/WM_PRINT which has wparam = 1 and lparam = 0.
Last edited on
How can I send HDC within message? SendMessage(HWindow, WM_PRINTCLIENT, HDC, 0);
prints error cannot convert parameter 3 from 'HDc' to 'WPARAM'

Or I tryied:
SendMessage(HCapture, WM_COMMAND, 0, HDc);
and recieved error:
C2664: 'SendMessageW' : cannot convert parameter 4 from 'HDC' to 'LPARAM'
There is no context in which this conversion is possible
Last edited on
You can pass any values (complex types as pointer). You just have to cast it to WPARAM or LPARAM. See

http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751%28v=vs.85%29.aspx


For examples how the prameters are used, see this:

http://msdn.microsoft.com/en-us/library/windows/desktop/ff468922%28v=vs.85%29.aspx


SendMessage() waits until the message is procressed, while PostMessage() doesn't.


Any message that will pass through WindowProc and can keep the HDC value?
Yes, SendMessage() is the right function


By gdi stuff I was refering to:
http://www.cplusplus.com/forum/beginner/130775/#msg706737
U got your answer.
Topic archived. No new replies allowed.