I would like to draw and move my windows by myself (using chromium embedded framework). To do this, i need a global callback when the mouse is being moved, outside of my window - so i installed a low level mouse hook:
hMouseLLHook = SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)mouseHookProc, hInstance, NULL);
The hook simple grabs the mouse events and calls "CallNextHookEx". No problems here, everything works as excpected. My problem now: if the debugger breaks or an exception is being thrown, I can't move the mouse anymore..
I tried processing the hook in another thread, like so:
HANDLE mouseProcHandle = CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)mouseProcessor, NULL, NULL, &dwMouseProcThread);
DWORD WINAPI Win32Application::mouseProcessor(LPVOID lpParm) {
hMouseLLHook = SetWindowsHookEx(WH_MOUSE_LL, (HOOKPROC)mouseHookProc, ((Win32Application*)Application::getInstance())->hInstance, NULL);
MSG message;
while (GetMessage(&message, NULL, 0, 0)) {
TranslateMessage(&message);
DispatchMessage(&message);
}
UnhookWindowsHookEx(hMouseLLHook);
return 0;
}
But this also does not solve the problem. Is there a workaround, solution or another method to do this? Also, I think a low level hook may not be necessary, as I only need to be informed about the moevement and it wouldn't be a problem if I would be the last one in line, so the system/other processes can process the mouse callbacks first.