From a .net application I wish to capture all keyboard events, globally.
I set a callback using a win32-method SetWindowsHookEx(WH_KEYBOARD, HINSTANCE). (Using dllimport and some mashall-call.)
One the first key is pressed I get a nice response saying which key is pressed.
My callback-function calls CallNextHookEx as is should do.
But after the first event I get no more events.
Any-one has any idea of common causes for events to stop coming?
WH_KEYBOARDis not supported from a managed wrapper, it needs to inject itself into the process.You can use
WH_KEYBOARD_LLwhich will be called in the declaring thread.see: http://support.microsoft.com/kb/318804