Closed jjmdekroon closed 4 months ago
Hello! Thanks for posting this question!
The problem is that you should handle MousePressed
and MouseReleased
separately. MouseClicked
is a synthetic event created by libuiohook when the mouse is released after being pressed without movement. As such, when you suppress MouseClicked
, you are really only suppressing the release event, so Windows thinks that the mouse button is still in the 'pressed' state. Instead, you should suppress MousePressed
and MouseReleased
directly.
This is indeed the solution, thanks for your quick reply !
I would like to attach actions to a specific mouse button (except left and right button)
I have attached an event handler to the MouseClicked. In this eventhandler I want to use the EventSimulator to send the CTRL C key combinations. And then after that I set the SuppressEvent to true so the mousebutton is not handled in windows anymore.
As an example I want to copy the selected text with the mouse Button3 and I think the CTRL-C consist of 4 steps: 1 - SimulateKeyPress(KeyCode.VcLeftControl) 2 - SimulateKeyPress(keyCode.VcC) 3 - SimulateKeyRelease(keyCode.VcC) 4 - SimulateKeyRelease(keyCode.VcLeftControl)
But when running the code and after I clicked on the button3 the mouse hoover and clicks does nothing in windows anymore. It is sort of switched off. When I remove the SuppressEvent line then windows does react on the mouse hoover and left clicks. But then the button3 event is also handled by windows.
So my question is how to replace the button clicks on a mouse by for instance a ctrl-C or ctrl-v ? in such way that windows is not handling the button click anymore.