On the Windows operating system, the mouse usually has two buttons: right and left. You may want to swap the buttons so that pressing the left button triggers a right-button event and vice versa. This might be useful for left-handed users, for example.
While the Windows Control Panel provides this option, you can also do it from a Visual Basic 6 program. To swap the mouse buttons, you'll use the function whose declaration is below:
Declare Function SwapMouseButton Lib "user32" (ByVal bSwap As Long) As Long
Set the argument bSwap to a nonzero value to swap the mouse buttons. Then set it to zero to return to the normal nonswapped state. The return value is True if the mouse buttons were already swapped when the function was called—otherwise it's False.
Note: The mouse is a shared resource, so the setting you make with this function affects all applications and not just your Visual Basic application.
Advance your scripting skills to the next level with TechRepublic's free Visual Basic newsletter, delivered each Friday. Automatically sign up today!