Attached is an Autoclicker i made: You can set the time between clicks and it also has a global hotkey for enabling it.
Here is the code: Note: You will have to add a stausbar, couple of labels, 2 buttons and a textbox or you cna just download the source.
Code:
Public Class Form1
Const MOUSEEVENTF_LEFTDOWN As Integer = 2
Const MOUSEEVENTF_LEFTUP As Integer = 4
Private Declare Sub mouse_event Lib "user32.dll" ( _
ByVal dwFlags As Integer, ByVal dx As Integer, _
ByVal dy As Integer, ByVal cButtons As Integer, _
ByVal dwExtraInfo As IntPtr)
Private Enum Modifiers
MOD_ALT = &H1
MOD_CONTROL = &H2
MOD_SHIFT = &H4
MOD_WIN = &H8
End Enum
Private Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As IntPtr, _
ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) _
As Integer
Private Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer) As Integer
Public Const WM_HOTKEY As Integer = &H312
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RegisterHotKey(Me.Handle.ToInt32, 0, 0, System.Windows.Forms.Keys.F11)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
StatusBar1.Text = "AutoClicking..."
Timer1.Interval = TextBox1.Text
Timer1.Enabled = True
Catch bad As Exception
MessageBox.Show("There has been an error please type a number value in the textbox" & vbCrLf & bad.Message, "Noob! Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Try
mouse_event(MOUSEEVENTF_LEFTDOWN + MOUSEEVENTF_LEFTUP, 0, 0, 0, IntPtr.Zero)
Catch bad As Exception
MessageBox.Show("There has been an error please type a number value in the textbox" & vbCrLf & bad.Message, "Noob! Error!", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
StatusBar1.Text = "Ready..."
Timer1.Enabled = False
End Sub
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
If Timer1.Enabled = True Then
e.Cancel = True
MessageBox.Show("You must stop autoclicking first!", "Stop autoclicker!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Timer1.Enabled = False
Else
UnregisterHotKey(Me.Handle.ToInt32, 0)
End If
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = WM_HOTKEY Then
If Timer1.Enabled = False Then
Timer1.Enabled = True
Timer1.Interval = TextBox1.Text
StatusBar1.Text = "AutoClicking..."
Else
Timer1.Enabled = False
StatusBar1.Text = "Ready..."
End If
End If
MyBase.WndProc(m)
End Sub
End Class