Window connection questions
I am using this:
SetWindowsHookEx(WH_CALLWNDPROC, ...);
I see messages that I want to process, but I want the message not to go to the target window. So I tried this:
SetWindowsHookEx(WH_GETMESSAGE, ...);
When I do this, I can change the message and prevent the target window from processing it, but this hook doesn't see the messages that I need to process. I'm guessing this is because it is being sent to the application's window queue rather than dispatched? Is there a way to get around this problem? I heard that a window subclass might be able to accomplish this, but can I subclass the window in another process? Is there a way to do this using interceptors?
a source to share
The hook documentation suggests this is not possible, but I assume this strategy might work: use SetWindowsHookEx (WH_CALLWNDPROC, ...)
In the procedure, just change the message you want to throw to the unused WM_ value.
LRESULT CALLBACK CallWndProc(int nCode,WPARAM wParam,LPARAM lParam)
{
CWPSTRUCT *C=(CWPSTRUCT *)lParam;
if ( ...we are interested in this one) {
..deal with this message here...
//Modify the message so that the client will ignore it
C->message=WM_USER+44; //presumably ignored by client
}
return GetNextHook(...);
}
Disgusting but easy?
a source to share