I am working on an application that needs to detect keyboard/mouse
events raised in the system *after* they have been delivered to the
target program. I tried using windows hooks (SetWindowsHookEx) but
they seem to get delivered before being sent to the target program.
Is there any way this can be done? Please help.
Thanks.
--
Ranju. V
http://blogorama.nerdworks.in/
--
I managed to figure this one out myself. It turns out that if you call
"CallNextHookEx" first then the message gets processed just fine. So
where I was doing this from the hook routine before:
PostMessage( hwndTarget, WM_HOOKED, 0, 0 );
return CallNextHookEx( NULL, nCode, wParam, lParam );
I changed it to look like this:
LRESULT lResult = CallNextHookEx( NULL, nCode, wParam, lParam );
PostMessage( hwndTarget, WM_HOOKED, 0, 0 );
return lResult;
And that's it!