'変数の明示的な宣言を強制します
Option Explicit
'API関数SwapMouseButtonの利用を宣言します
Private Declare Function SwapMouseButton Lib "user32"
(ByVal bSwap As Long) As Long
'引 数:左右のボタンの機能を交換する場合は、True
' 左右のボタンの機能を元に戻す場合は、False
'戻り値:(関数の実行以前に)ボタンの機能が交換されていた場合は、0
' (関数の実行以前に)ボタンの機能が交換されていなかった場合は、0以外
Private Sub Command1_Click()
Dim ret As Long
'マウスの左右のボタンの機能を入れ替えます
ret = SwapMouseButton(True)
End Sub
Private Sub Command2_Click()
Dim ret As Long
'入れ替えた左右のボタンの機能を元に戻します
ret = SwapMouseButton(False)
End Sub
Private Sub Form_Load()
Command1.Caption = "入れ替える"
Command2.Caption = "元に戻す"
End Sub