ok so i think i over thought something or im missing something small here i want this to activate on the mousedown and deactivate on mouseup after the button is clicked
so it would be like this
1Click button
2press and hold mouse to active
3depress mouse to deactivate
heres my code im trying any ideas
[php]Public Class Form1
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16
Private Declare Sub mouse_event Lib "user32" (ByVal dwflags As Int32, ByVal dx As Int32, ByVal dy As Int32, ByVal cbuttons As Int32, ByVal dwExtraInfo As Int32)
Private Const LButtonDown = &H2
Private Const LButtonUp = &H4
Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
Do Until Timer1.Enabled = False
mouse_event(LButtonDown, 0, 0, 0, 0)
mouse_event(LButtonUp, 0, 0, 0, 0)
Loop
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If GetAsyncKeyState(LButtonDown) = True Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If
End Sub
End Class[/php]
i had it working but as soon as you pressed the button it spammed mouse click (like it should when the mouse button is held down) and yea i have this annoying error beep going on now i just muted it lol dont feel like restarting
ok so i think i over thought something or im missing something small here i want this to activate on the mousedown and deactivate on mouseup after the button is clicked
so it would be like this
1Click button
2press and hold mouse to active
3depress mouse to deactivate
heres my code im trying any ideas
[php]Public Class Form1
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16
Private Declare Sub mouse_event Lib "user32" (ByVal dwflags As Int32, ByVal dx As Int32, ByVal dy As Int32, ByVal cbuttons As Int32, ByVal dwExtraInfo As Int32)
Private Const LButtonDown = &H2
Private Const LButtonUp = &H4
Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
Do Until Timer1.Enabled = False
mouse_event(LButtonDown, 0, 0, 0, 0)
mouse_event(LButtonUp, 0, 0, 0, 0)
Loop
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If GetAsyncKeyState(LButtonDown) = True Then
Timer1.Enabled = True
Else
Timer1.Enabled = False
End If
End Sub
End Class[/php]
i had it working but as soon as you pressed the button it spammed mouse click (like it should when the mouse button is held down) and yea i have this annoying error beep going on now i just muted it lol dont feel like restarting
Okay, first of all your logic for the timer is all wrong. You can't use a timer_tick event if the timer is disabled. Why not just use simple hotkeys like so:
[php]
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If GetAsyncKeyState(Keys.F10) Then
Call DoClick '//call the click sub.
Timer1.Stop() '//stop the timer until you've stopped clicking.
End if
End Sub
Private Sub DoClick()
Do Until GetAsyncKeyState(Keys.F10)
mouse_event(LbuttonDown, 0, 0, 0, 0)
mouse_event(LbuttonDown, 0, 0, 0, 0)
Loop
End Sub
[/php]
That way it won't start clicking until you press F10 and won't stop 'til it's pressed again.
Timer1.Start() '//upon exiting the loop you'll reach this line and start the hotkey timer up again.
ok thanks to some help from j-Deezy i got it working on a hot key now from here is there a way to make LButton aka left mouse button the hot key ie.. down = on up= off
so that when you press and hold lbutton down it turns the auto clicker on and when you release it it shuts off?
thanks again
heres what i have now
[php]Public Class Form1
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16
Private Declare Sub mouse_event Lib "user32" (ByVal dwflags As Int32, ByVal dx As Int32, ByVal dy As Int32, ByVal cbuttons As Int32, ByVal dwExtraInfo As Int32)
Private Const LButtonDown = &H2
Private Const LButtonUp = &H4
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If GetAsyncKeyState(Keys.Add) Then
Threading.Thread.Sleep(100)
Call DoClick() '//call the click sub.
Timer1.Stop() '//stop the timer until you've stopped clicking.
End If
End Sub
Private Sub DoClick()
Do Until GetAsyncKeyState(Keys.Subtract)
mouse_event(LButtonDown, 0, 0, 0, 0)
mouse_event(LButtonUp, 0, 0, 0, 0)
Loop
Timer1.Start()
End Sub
End Class[/php]
Originally Posted by Maniac101
ok thanks to some help from j-Deezy i got it working on a hot key now from here is there a way to make LButton aka left mouse button the hot key ie.. down = on up= off
so that when you press and hold lbutton down it turns the auto clicker on and when you release it it shuts off?
thanks again
heres what i have now
[php]Public Class Form1
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16
Private Declare Sub mouse_event Lib "user32" (ByVal dwflags As Int32, ByVal dx As Int32, ByVal dy As Int32, ByVal cbuttons As Int32, ByVal dwExtraInfo As Int32)
Private Const LButtonDown = &H2
Private Const LButtonUp = &H4
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If GetAsyncKeyState(Keys.Add) Then
Threading.Thread.Sleep(100)
Call DoClick() '//call the click sub.
Timer1.Stop() '//stop the timer until you've stopped clicking.
End If
End Sub
Private Sub DoClick()
Do Until GetAsyncKeyState(Keys.Subtract)
mouse_event(LButtonDown, 0, 0, 0, 0)
mouse_event(LButtonUp, 0, 0, 0, 0)
Loop
Timer1.Start()
End Sub
End Class[/php]
hehe sorry it was my fault ther error was there to begin with . Accidently wrote mouse_event(LbuttonDown, 0, 0, 0, 0) twice instead of mouse_event(LButtonUp, 0, 0, 0 ,0) for one of them /
yea its cool should have seen it myself read over ti thousands of times and just over looked it