Hook Procedure not working when window is minimized

Started by
1 comment, last by Antheus 16 years, 10 months ago
Problem : my hook procedure is not working when the main window losts focus or minimized... description: i have written a global hook procedure to track the keystrokes. the hook procedure resides in a dll and i am calling it from the main window. from the dll i am displaying the keycode using a messagebox. it is working globally... then problem is when i tried to write the keypress to a file it is working but when the main window losts focus the keystrokes are not written to the file but it displayed... i tried to pass the value to the main window using WM_COPYDATA but neither of the options helped... i was able to reveice the WM_COPYDATA message in the main window only when the window is active and when my window goes inactive it dosent work... how to solve this... i am using dev C++ ide... i am using C style and not c++ or MFC...what should be done to make the main window always receive messages from the hook procedure???
Advertisement
Please post your code, particularly your window procedure and your message pump(s).

Also, you might consider using a low level IO hook instead of a global DLL hook (WH_KEYBOARD_LL instead of WH_KEYBOARD); it eliminates the need for the DLL and simplifies things greatly, at the cost of not working on Windows 98 and requiring a little bit more performance overhead.

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

So, a keylogger?

This topic is closed to new replies.

Advertisement