I have a WSAWaitForMultipleEvents
based loop, that (in addition to other stuff), triggers on keyboard and mouse events. Firstly setting:
SetConsoleMode(GetStdHandle(STD_INPUT_HANDLE), ENABLE_EXTENDED_FLAGS | ENABLE_PROCESSED_INPUT | ENABLE_MOUSE_INPUT);
And then using:
GetStdHandle(STD_INPUT_HANDLE);
As an event added to WSAWaitForMultipleEvents
.
Now this is working fine but I'm really only interested in the mouse position when clicked. But naturally it is triggering for mouse movement as well. Is there any way of excluding mouse movement from the event such that WSAWaitForMultipleEvents
will only awaken on mouse click and will ignore mouse movement?
CodePudding user response:
Is there any way of excluding mouse movement from the event such that
WSAWaitForMultipleEvents
will only awaken on mouse click and will ignore mouse movement?
No. Using ENABLE_MOUSE_INPUT
means that the console handle satisfies the wait on any mouse activity within the console window while the window is focused. That includes both mouse movements and mouse clicks. The documentation even says as much. So, you will just have to receive and discard the console events that you are not interested in.