Sign in to follow this  

Hook Procedure not working when window is minimized

This topic is 3847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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???

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 3847 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this