Reputation: 1427
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.
Upvotes: 5
Views: 1037
Reputation: 9117
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.
Upvotes: 9