SwapMouseButton Function

Declare Function SwapMouseButton Lib "user32.dll" (ByVal bSwap As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

SwapMouseButton alters the mapping used for the mouse buttons. Windows allows you to interpret left-button clicks as right-button clicks and vice versa. This functionality is designed for people who use the mouse left-handed. Of course, Windows is normally the only program to ever change this, so do it with caution -- it of course affects mouse usage in all programs as well as Windows itself. The function returns 1 if successful, or 0 if an error occured.

bSwap
Determines the mouse button mapping. 0 means do not swap the buttons (left means left, right means right). 1 means swap the left and right buttons (left means right, right means left). Note that "swapping" is relative to the normal left-left mapping, not to the current one.

Example:

' Swap the left and right mouse buttons.  You probably would never
' do this in a program unless the user specifically asked for it (as he/she does in
' Windows's Control Panel).
Dim retval As Long  ' return value

retval = SwapMouseButton(1)  ' switch the left and right buttons
' Now left means right even if this had previously been the case.
Debug.Print "The mouse buttons are currently swapped."

Category: Mouse

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/s/swapmousebutton.html