I'm just starting, (mainly by looking at other people's code) and have made an autoclicker. It's very simple, and easy to understand. but there's a major flaw. no hotkey to start/stop the code. DX I need to find out how to do that, so that F1 executes this code:
timer1.start
and F2 does
timer1.stop
If you could, add some comments to help me understand. Thanks!
Edit: Here's the code. you need 1 timer, 3 buttons, and 1 label with the default text set to 0.
Public Class Form1
Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Stop()
End Sub
Private Sub MyMethod()
Windows.Forms.Cursor.Position = New System.Drawing.Point(Windows.Forms.Cursor.Position)
mouse_event(&H2, 0, 0, 0, 1)
mouse_event(&H4, 0, 0, 0, 1)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Label1.Text = Label1.Text + 1
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
MyMethod()
End Sub
End ClassLast edited by 16Skittles (2010-12-11 11:27:40)
Offline
It's easy
Here is an example:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.F2 Then
timer1.stop
End If
End SubI hope this helps
OB6160

Offline