I want to send some mouse click messages to a specified window of another program. I currently use WM_LBUTTONUP
and WM_LBUTTONDOWN
messages whose works fine.
These messages performs exactly same way regardless of a user's mouse button settings. Oppose from it, I want to know if user has swapped mouse buttons from mouse settings control panel.
I researched and found SwapMouseButton
function, it works fine but I don't want to swap mouse buttons actually and I just want to know whether it is previously swapped or not.
From MSDN:
If the meaning of the mouse buttons was reversed previously, before the function was called, the return value is nonzero.
I can get the information I want this way, but it also restores them to original state of mouse buttons. I only want to check and not to restore to original state.
I currently call this function like:
SwapMouseButton(FALSE);
I like to know any other alternative way (something like SystemParametersInfo
) to only check (not to also restore) whether mouse buttons has previously swapped by user.
Basically, what I want to do is simulate a primary mouse button click and a secondary mouse button click according to user's mouse button meanings.
For example, when I simulate a primary mouse button click, and if user has swapped the mouse buttons, right mouse click should simulate, otherwise left, as usual. There are no messages exist called WM_PRIMARY...
and WM_SECONDARY...
for me to do what I want.
Thanks in advance.
MB1 (mouse button 1) is the left button. MB2 (mouse button 2) is the middle button. MB3 (mouse button 3) is the right button.
To change how the mouse buttons work In the search box, type mouse, and then click Mouse. Click the Buttons tab, and then do any of the following: To swap the functions of the right and left mouse buttons, under Button configuration, select the Switch primary and secondary buttons check box.
Right-click on the dropdown box and right-click on Left to restore the left mouse button. Remember, your mouse buttons are reversed because usually, we would left-click to change settings. Windows 7, Vista, and 8 users will see a box that reads Switch primary and secondary buttons. Uncheck that box if checked.
You can use GetSystemMetrics with SM_SWAPBUTTON
parameter value.
SM_SWAPBUTTON 23
Nonzero if the meanings of the left and right mouse buttons are swapped; otherwise, 0.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With