You can get the mouse click with this.
Add a timer "for my code call it DeskClick"
Add a textbox called ShowMouseClick "so you can check"
Private Declare Function GetAsyncKeyState Lib "user32" _
(ByVal vKey As Long) As Integer
Private Const LBUTTON = &H1
Private Const RBUTTON = &H2
Private Sub DeskClick_Tick(sender As Object, e As EventArgs) Handles DeskClick.Tick
If GetAsyncKeyState(LBUTTON) Then
ShowMouseClick.Text = "Left Click"
ElseIf GetAsyncKeyState(RBUTTON) Then
ShowMouseClick.Text = "Right Click"
Else
ShowMouseClick.Text = ""
End If
End Sub
you also need to turn of PInvokeStackImbalance
Go to Debug then select Exceptions Then MDA and deselect PInvokeStackImbalance
Maybe this is not the best way but it works perfect in my app Whit out any problem
To capture the event and do something
Private Sub ShowMouseClick_TextChanged(sender As Object, e As EventArgs) Handles ShowMouseClick.TextChanged
If ShowMouseClick.Text = "Left Click" Then
TextBox1.Focus()
SendKeys.Send("{3}")
SendKeys.SendWait("{1}")
End If
End Sub