I\'m trying to set a low level windows keyboard hook to grab three keys pressed even if the application is not in focus. To do this I\'m calling SetWindowsHookEx as
From the documentation for SetWindowsHookEx
hMod [in]
HINSTANCE
A handle to the DLL containing the hook procedure pointed to by the lpfn parameter. The hMod parameter must be set to NULL if the dwThreadId parameter specifies a thread created by the current process and if the hook procedure is within the code associated with the current process.
So you should be passing in IntPtr.Zero for NULL
//install hook
hKeyboardHook = SetWindowsHookEx(
WH_KEYBOARD_LL,
KeyboardHookProcedure,
IntPtr.Zero,
0);