Frank
2011-06-20 14:37:44 UTC
Dear people,
I'd like to install a hook to intercept all messages
sent to any program on the computer. This is my
code so far:
HMODULE hMod = GetModuleHandle(0);
HHOOK hHook = SetWindowsHookEx(WH_CALLWNDPROC, HookProc, hMod, 0);
ULONG ulError = GetLastError();
Now what I get is a NULL handle for hHook and
an ulError of ERROR_HOOK_NEEDS_HMOD
("Cannot set nonlocal hook without a module handle").
But I provided a valid hMod. What am I doing wrong?
I'd like to install a hook to intercept all messages
sent to any program on the computer. This is my
code so far:
HMODULE hMod = GetModuleHandle(0);
HHOOK hHook = SetWindowsHookEx(WH_CALLWNDPROC, HookProc, hMod, 0);
ULONG ulError = GetLastError();
Now what I get is a NULL handle for hHook and
an ulError of ERROR_HOOK_NEEDS_HMOD
("Cannot set nonlocal hook without a module handle").
But I provided a valid hMod. What am I doing wrong?