Code:
' ---------------------------------------------------------------------------
' Program Title: Swap Mouse Buttons
'        Author: Donnie Ewald
' Last Modified: August 20, 2009
 
'      Compiler: PB/CC 4.04
'  Win32api.inc: 21 February 2005
' ---------------------------------------------------------------------------
'   Description: Swaps the left and right mouse button functions. Read MSDN:
'                http://msdn.microsoft.com/en-us/library/ms646264(VS.85).aspx
'                ...for more information. This utility is useful for allowing
'                a mouse-user that is left-handed to quickly change the
'                Control Panel mouse setting.
' ---------------------------------------------------------------------------

#COMPILE EXE
#DIM ALL
'#INCLUDE "WIN32API.INC"

' Created by incLean v1.27, 08-20-2009, 04:37:43
'-----------------------------------------------------------------
' Equates:  5
'-----------------------------------------------------------------
%WINAPI                 = 1
%TRUE                   = 1
%FALSE                  = 0
%SM_SWAPBUTTON          = 23
%SPI_SETMOUSEBUTTONSWAP = 33

'-----------------------------------------------------------------
' Declared Functions:  2
'-----------------------------------------------------------------
DECLARE FUNCTION GetSystemMetrics LIB "USER32.DLL" ALIAS "GetSystemMetrics" (BYVAL nIndex AS LONG) AS LONG
DECLARE FUNCTION SystemParametersInfo LIB "USER32.DLL" ALIAS "SystemParametersInfoA" (BYVAL uAction AS DWORD, BYVAL uParam AS DWORD, lpvParam AS ANY, BYVAL fuWinIni AS DWORD) AS LONG

FUNCTION PBMAIN
  LOCAL Jack AS LONG

  if (GetSystemMetrics(%SM_SWAPBUTTON)) then
    SystemParametersInfo(%SPI_SETMOUSEBUTTONSWAP, %FALSE, Jack, 0)
  else
    SystemParametersInfo(%SPI_SETMOUSEBUTTONSWAP, %TRUE, Jack, 0)
  end if
END FUNCTION