devxlogo

Swap the mouse buttons’ behavior and meaning

Swap the mouse buttons’ behavior and meaning

You can programmatically swap the meaning of the left and right mouse buttons, to account for your left-handed users. All you need is a call to the SystemParameterInfo API function

Private Declare Function SystemParametersInfo Lib "user32" Alias _    "SystemParametersInfoA" (ByVal uAction As Long, ByVal uParam As Long, _    ByRef lpvParam As Any, ByVal fuWinIni As Long) As LongPrivate Const SPI_SETMOUSEBUTTONSWAP = 33' swap the two mouse buttonsSystemParametersInfo SPI_SETMOUSEBUTTONSWAP, True, ByVal 0&, 0

To restore the regular mouse behavior, you need a second call to the same API function, but passing False in its second argument:

' restore regular mouse buttons behaviorSystemParametersInfo SPI_SETMOUSEBUTTONSWAP, False, ByVal 0&, 0

devx-admin

Share the Post: