0
votes

I would like to detect mouse events like left button click, right button click etc in win32. 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.

2

2 Answers

3
votes

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

1
votes

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