How To: Make an Auto Clicker in Visual Basic 2008

Make an Auto Clicker in Visual Basic 2008

This article will show you how to make an auto clicker program in Visual Basic Express Edition 2008.  An auto clicker is a very useful program that makes your mouse click many times automatically, wherever it's pointed.  It's a very good AFK (away from keyboard) program.  Just point your mouse on your screen and turn it on!  It's very useful for computer games (FPS, MMORPG, and others).

Click here to download Visual Basic 2008 Express Edition

Step 1 Open a New Project

Open Visual Basic 2008.  Do a New Project (File > New Project or Ctrl+N)

How to Make an Auto Clicker in Visual Basic 2008

Now, select Windows Forms Application and name it whatever you want.

How to Make an Auto Clicker in Visual Basic 2008

Okay, you've created a new project!

Step 2 What's Needed

For this auto clicker, you will need:

  • 4 Buttons
  • 2 TextBoxes
  • 1 Timer
  • Optional GroupBox

Like this:

How to Make an Auto Clicker in Visual Basic 2008

Save your project.

Step 3 Name Buttons and Config Form1

  • Name Button1 to Start = F3
  • Name Button2 to Stop = F4
  • Name Button3 to Interval
  • Name Button4 to Test Clicker
  • Name TextBox2 to 1
  • If you have a GroupBox, name it to Auto-Click
  • Name Form1 to (Your name here)'s Auto-Clicker
  • In Form1 Properties, select "MaximizeBox" and make it False.
  • Select "Show Icon" and make it false, too.

Now, it should look like this:

How to Make an Auto Clicker in Visual Basic 2008

Save your project.

Step 4 Coding

Now, let's go to the code part.

In the top of the code (under Public Class Form1) write this:

Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Note

  • user32 is for x32 computers - change to user64 to x64 computers.

Double click on Form1 and write this:

MsgBox("My first auto-clicker - WonderHowTo.com", MsgBoxStyle.Information + MsgBoxStyle.OkOnly, "WonderHowTo.com")

Write this under Form1_Load:

Private Sub MyMethod()
        Windows.Forms.Cursor.Position = New System.Drawing.Point(Windows.Forms.Cursor.Position)
        mouse_event(&H2, 0, 0, 0, 1) 'cursor will go down (like a click)
        mouse_event(&H4, 0, 0, 0, 1) ' cursor goes up again
    End Sub

Now, double click on Timer1 and write this:

MyMethod()

Now, go back to the design tab and double click on Start = F3 and write this:

Timer1.Start()

Double click on Stop = F4 and write this:

Timer1.Stop()

Double click on Interval and write this:

          If TextBox1.Text = ("") Then
            MsgBox("Please, put a valid number value", MsgBoxStyle.Critical + MsgBoxStyle.OkOnly, "ERROR")
        Else
            Timer1.Interval = ((TextBox1.Text) * (1))
        End If

Double Click on Test Clicker and write this:

TextBox2.Text = TextBox2.Text + 1

Save your project.

Step 5 Hotkey Part

Okay guys!  This is the last part before debug the project.

Do this:

Double click on Form1.  In top (but under the tabs), you will see a bolt.

How to Make an Auto Clicker in Visual Basic 2008

Click in the bolt and select KeyDown. Then, write this:

        If e.KeyCode = Keys.F3 Then
            Timer1.Start()
        Else
            If e.KeyCode = Keys.F4 Then
                Timer1.Stop()
            End If
        End If

Now, go to Form1_Load and write this:

KeyPreview = True

Save your project.

Step 6 Debug and Test It

You're done your Auto-Clicker!  Just press F5 (or click in the green arrow) for debug.

Put an interval (1 is the fastest speed; 1000 = 1 click per second), hover mouse in "Test Click" and press F3 to start.  Works?  Okay, now press F4 to stop.

Now, just share with your friends and be happy!

Just updated your iPhone? You'll find new Apple Intelligence capabilities, sudoku puzzles, Camera Control enhancements, volume control limits, layered Voice Memo recordings, and other useful features. Find out what's new and changed on your iPhone with the iOS 18.2 update.

4 Comments

Well done ...
this is not work on visual studio 2012 .Need little tweaking ..
Under solution properties , need put for TARGET FRAMEWORK ".NET framework 3.5"
For net framework 4.5 , don't work .
After this correction , work perfect .
I see this on https://www.youtube.com/watch?v=fSmCNJBAReE

i am a beginner i don't know much about it
i am getting error while adding the code at step 4.

error message is"Error 1 A namespace does not directly contain members such as fields or methods"

this is when i pasted the code after namespace, when i pasted after class form1 i gor 20 errors says expected ; ,invalid expression ) etc

am using VS 2008
what to do?
help me plz

English: Create a timer on the priorities it set enabled = true and interval set 1, a double-click on it and enter the code to know if the program shortcut keys foran activated

Portugues: Crie um timer nas prioridades dele coloque enabled = true e em interval coloque 1, de um click duplo sobre ele e coloque o seguinte codigo para o programa saber se as teclas de atalho foran ativadas

Dim Hotkey As Boolean
Dim HotkeyB As Boolean
Hotkey = GetAsyncKeyState(Keys.F3)
If Hotkey = True Then
Timer1.Start()
End If

Hotkey = GetAsyncKeyState(Keys.F4)
If Hotkey = True Then
Timer1.Stop()
End If

Share Your Thoughts

  • Hot
  • Latest