How to know if mouse buttons are switched ?

  • Thread starter Thread starter Herve Bocuse
  • Start date Start date
H

Herve Bocuse

In the mouse control panel it is possible for a user to switch the
mouse buttons.
How to programmatically check this ? I need this to know if I have to
fire a left or right mouse button with the mouse_event win32 function.

Thank you

Nicolas
 
How to programmatically check this ?

I don't know if the information is available from any managed class,
but you can check it with GetSystemMetrics(SM_SWAPBUTTON).


Mattias
 
Hi Nicolas,

If the buttons are switched, the left mouse button will send MouseButtons.Right and the right button will be MouseButtons.Left so your application should work properly either configuration.

If you really need to know which configurations there are probably some registry key you could check for or use SwapMouseButton from the User32.dll. The return value will tell if the buttons were swapped to begin with.
 
Back
Top