开发者

how to detect mouse events in win32 api?

开发者 https://www.devze.com 2023-02-03 03:42 出处:网络
I would like to detect mouse events like left button click, right button click etc in w开发者_Go百科in32. Is it possible to detect these events anywhere on the screen, not just over the window?

I would like to detect mouse events like left button click, right button click etc in w开发者_Go百科in32. Is it possible to detect these events anywhere on the screen, not just over the window?

From my search i found setCapture() function but it requires a handle to the window, and i do not want to use a window.

Thank you.


you must try using a wide system hook to detect the mouse activity. check the WH_MOUSE_LL and the WH_MOUSE hooks.


Use winapi GetKeyState function https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms646301%28v=vs.85%29.aspx

Parameter: 1 - left mouse click, 2 - right mouse click, etc

0

精彩评论

暂无评论...
验证码 换一张
取 消