Grab exclusively/release mouse in application (Windows, C++)

核能气质少年 提交于 2019-12-06 11:46:09

Possibly it because of this
http://doc.51windows.net/Directx9_SDK/?url=/directx9_sdk/input/ref/ifaces/idirectinputdevice9/setcooperativelevel.htm
""An application that acquires the mouse or keyboard device in exclusive mode should always unacquire the devices when it receives WM_ENTERSIZEMOVE and WM_ENTERMENULOOP messages.
Otherwise, the user cannot manipulate the menu or move and resize the window.""

May be its not totally answer
But try also to check if may be you not unacquire mouse on some other messeges.
For example on WM_LOSTFOCUS, etc.

You could try to use plain API calls:

HMODULE hDll = LoadLibrary("magicfuncdll.dll");
HOOKPROC hookLowLevelMouseFilter = (HOOKPROC)GetProcAddress(hDll, "_MagicFuncDLL_LowLevelMouseFilterProc@12");

// capture mouse events
HHOOK hMouseHook = SetWindowsHookEx(WH_MOUSE_LL, hookLowLevelMouseFilter, hDll, 0);

... do your thing

// release mouse
UnhookWindowsHookEx(hMouseHook);
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!