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

See also  5 Tips for Working With an Onsite Interpreter
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist