I have code that has been working without any reported issues for a few years. It sets up a low level keyboard hook that the user uses to activate the application.
m_hKeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeybHookFn, GetModuleHandle(NULL), 0);
For one user all of a sudden (it worked for him before for years as well), the keyboard hook isn't working. Upon investigation, I can see that SetWindowsHookEx() is returning NULL and GetLastError() is returning 0x00000597, which is ERROR_HOOK_NOT_INSTALLED.
I can't find any documentation on what this means.
What are possibilities for why this might happen? System security settings? User account privileges? The user is using Windows 7.
I need a specific answer to how to make this error occur so that I can solve the user's problem
GetModuleHandle(NULL)no longer returns the module handle to the module that contains the hook procedure. Using the__ImageBasepseudo linker variable will fix this issue. - IInspectable