SetWindowsHookEx() doesnt fail, as I previously stated, "MessageBox() is always called so I know I have the global hook setup correctly."
The problem is here;
if (jvm != NULL) {
if (jvm->AttachCurrentThread(
env->CallVoidMethod(hookOb
}
}
This is not executed properly by any process other than java, which means hooked events are only passed on to java when the java app is active, but MessageBox() is called regardless of the active application.
Main Topics
Browse All Topics





by: jkrPosted on 2008-01-02 at 10:27:36ID: 20566399
What do you get as the error code when the call to 'SetWindowsHookEx()' fails? BTW, there is a problem with your code:
WindowsHoo kEx failed with last error %d.",GetLastError());
mpt,"HookE rror", MB_OK | MB_ICONEXCLAMATION);
; also incorrect, you aren't allocating any memory
if (hkb == NULL) {
DWORD dw = GetLastError();
// LPSTR lpstrMyprompt; <--- error - that only declares a pointer, you need an array!
CHAR lpstrMyprompt[256]; // better ;o)
sprintf(lpstrMyprompt,"Set
MessageBox(NULL,lpstrMypro
//LocalFree(lpstrMyprompt)
ExitProcess(dw);
}