Public Class Form1
Public loop1 As Boolean = True
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim pMousePos As Point
While loop1
System.Windows.Forms.Application.DoEvents()
pMousePos = Control.MousePosition
Select Case Control.MouseButtons
Case Windows.Forms.MouseButtons.Left
MessageBox.Show("Mouse_Left(" & pMousePos.X.ToString & "," & pMousePos.Y.ToString & ")")
Case Windows.Forms.MouseButtons.Middle
MessageBox.Show("Mouse_Middle(" & pMousePos.X.ToString & "," & pMousePos.Y.ToString & ")")
Case Windows.Forms.MouseButtons.None
'MessageBox.Show("None")
Case Windows.Forms.MouseButtons.Right
MessageBox.Show("Mouse_Right(" & pMousePos.X.ToString & "," & pMousePos.Y.ToString & ")")
End Select
End While
End Sub
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Escape Then
loop1 = False
End If
End Sub
End Class