Alright, well you told me that it didn't click at all when you tried it. I have:
[php]Public Class Form1
'Declare mouseclick
Private Declare Sub mouse_event Lib "user32" (ByVal dvflags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cbuttons As Long, ByVal dvextrainfo As Long)
Private Const mouseclickup = 4
Private Const mouseclickdown = 2
'Get hotkeys
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'Timer start on button1 click
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'Timer stop on button2 click
Timer1.Stop()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'When timer ticks, click mouse
mouse_event(mouseclickdown, 0, 0, 0, 0)
mouse_event(mouseclickup, 0, 0, 0, 0)
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
'Declare hotkeys
Dim hotkey As Boolean
'Key F9 starts timer1
hotkey = GetAsyncKeyState(Keys.F9)
If hotkey = True Then Timer1.Start()
'Key F10 stops timer1
Dim hotkey1 As Boolean
hotkey1 = GetAsyncKeyState(Keys.F10)
If hotkey1 = True Then Timer1.Stop()
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer2.Start()
End Sub
End Class[/php]
Now I see that you have:
Code:
Private Const mousclickup = 4 Private Const mousclickdown = 2
Private Const mouseclickup = 4
Private Const mouseclickdown = 2
twice on it. Try what I have written. Works fine for me.