Mouse Click Event Validation Issue
-
Hi all, I have a strange issue where an app which I'm getting events from is sometimes producing right click events when a left mouse click is actually what happened. Is there a windows buffer I can read which will allow me to validate the event without having to record all the mouse events myself. Thanks
Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.
-
Hi all, I have a strange issue where an app which I'm getting events from is sometimes producing right click events when a left mouse click is actually what happened. Is there a windows buffer I can read which will allow me to validate the event without having to record all the mouse events myself. Thanks
Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.
I'm now using the lines:
SHORT rbstate = GetAsyncKeyState(VK_RBUTTON);
if (!rbstate) {
return;
}It just makes sure the right mouse button was the one used.
Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.
-
I'm now using the lines:
SHORT rbstate = GetAsyncKeyState(VK_RBUTTON);
if (!rbstate) {
return;
}It just makes sure the right mouse button was the one used.
Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.
Just want to add a little note. GetAsyncKeyState will return the state at the moment you're calling it, which will always be slightly later than the moment the message was generated. That shouldn't be a problem normally, but you might want to keep that in mind.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal
-
Just want to add a little note. GetAsyncKeyState will return the state at the moment you're calling it, which will always be slightly later than the moment the message was generated. That shouldn't be a problem normally, but you might want to keep that in mind.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition. Blaise Pascal
Thanks for the response. GetAsyncKeyState also returns a value > 0 if the key was pressed since the last call to it as well as if the event is currently active. If I'm checking for the right mouse key and someomeone enters the sequence: right key, left key, right key and I make a call each time, I should at least get 0,0 1. To counteract the first false negative I ignore the first call's result assuming that the first right click event is always correct as in this case the first event is what sets off the problem. I'm assuming this is what is going on as it now works. It's not the way I would have chosen. I'll have to keep an eye on it. Again, thanks for the comment,
Cheers Tom Philosophy: The art of never getting beyond the concept of life. Religion: Morality taking credit for the work of luck.