Mouse Hook Problem on virtual desktop
-
Hi, I have installed global mouse hooks in my application using following call g_MouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseProc , hInstance, 0); The mouse procedure is as follows extern "C" _declspec(dllexport) LRESULT CALLBACK MouseProc (int nCode, WPARAM wParam, LPARAM lParam) The MouseProc is calling successfully when current active desktop is "default". When i switch the desktop to some other desktop, the MouseProc is not calling. Can anyone tell me reason for this and also solution. sharda
-
Hi, I have installed global mouse hooks in my application using following call g_MouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseProc , hInstance, 0); The mouse procedure is as follows extern "C" _declspec(dllexport) LRESULT CALLBACK MouseProc (int nCode, WPARAM wParam, LPARAM lParam) The MouseProc is calling successfully when current active desktop is "default". When i switch the desktop to some other desktop, the MouseProc is not calling. Can anyone tell me reason for this and also solution. sharda
From the documentation for SetWindowsHookEx:
dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.This doesn't actually cure your problem, but hopefully it reassures you that you haven't made a daft mistake. Iain.
-
From the documentation for SetWindowsHookEx:
dwThreadId
[in] Specifies the identifier of the thread with which the hook procedure is to be associated. If this parameter is zero, the hook procedure is associated with all existing threads running in the same desktop as the calling thread.This doesn't actually cure your problem, but hopefully it reassures you that you haven't made a daft mistake. Iain.
thanks Iain, Actually i tried with both the options like g_MouseHook = SetWindowsHookEx(WH_MOUSE_LL, MouseProc , NULL,0); and g_MouseHook = SetWindowsHookEx(WH_MOUSE, MouseProc , NULL,GetCurrentThreadID()); Still in both the cases MouseProc is not called.