Reputation: 35
I have a big problem with SetWindowsHookEx and WH_CALLWNDPROC! When use SetWindowsHookEx for local hook
HHOOK hook = SetWindowsHookEx(WH_CALLWNDPROC, CallWndProc, GetModuleHandle(NULL), GetCurrentThreadId());
all work fine, but when i try set global hook or hook for other program:
HHOOK hook = SetWindowsHookEx(WH_CALLWNDPROC, CallWndProc, GetModuleHandle(NULL), threadId);
where threadId = GetWindowThreadProcessId(window, NULL);
and HWND window = ::FindWindow(NULL,"Program title");
i get NULL in hook...
I read very much for hooking but, i don't understand where is worng... I have a headache for a few days. Thank you in advance and sorry for my english.
Upvotes: 3
Views: 2772
Reputation: 7620
One way to do it:
LIBRARY
EXPORTS CallWndProc
Upvotes: 2