Golden. (06-12-2010),House (07-28-2010),karam98 (03-26-2011),Tony Stark` (02-17-2011)
Well this is my first Tutorial so please give me some comments about this.
What we will do in this tutorial?
- A simple Auto Clicker.
Hotkeys.
Interval
& more!
I will split this tutorial in 3 parts.1 part is for the button,2 part is for the GUI and things like that and 3 part is for coding.
First Part:
First,Open Microsoft Visual Basic 2008 Express Edition.
When it open press Ctrl+N.
Choose Windows Forms Applications and name it Simple Auto Clicker,and click OK.
You will need 3 Labels.
The label1 text should be F5 = Start
The label2 text should be F6 = Stop
The label3 text should be Speed of the clicks.
Than you will need 1 Textbox.
This should be under Speed of the clicks or beside it.
Than you will need 2 Timers.
Change Timer1 name to Hotkeys.
Enable do it False.
And Interval do it 1.
Change Timer2 name to Clicks.
Than just change Interval do 1000.
Part 2:
Click on Form1.
And go on Properties.
Change Maximize Box,Minimize Box and Show Icon to False.
Than change TopMost to True.
Don't do the background(GUI)so big do it like 300 , 150.
Part 3:
So this will be the coding.
Double Click On Form1 and Delete Everything in there.
Than copy and paste this code:
Press F5 and it should start Debugging.Code:Public Class Form1 Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer Private Declare Sub mouse_event Lib "user32" (ByVal dwflags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cbuttons As Long, ByVal dwExtraInfo As Long) Private Const mouseclickup = 4 Private Const mouseclickdown = 2 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotkeys.Tick Dim Hotkey1 As Boolean Hotkey1 = GetAsyncKeyState(Keys.F5) If Hotkey1 = True Then Clicks.Start() End If Dim Hotkey2 As Boolean Hotkey2 = GetAsyncKeyState(Keys.F6) If Hotkey2 = True Then Clicks.Stop() End If End Sub Private Sub Click_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clicks.Tick Clicks.Interval = TextBox1.Text mouse_event(mouseclickdown, 0, 0, 0, 0) mouse_event(mouseclickup, 0, 0, 0, 0) End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click End Sub End Class
Than Save it.
Credits:
VBFX~For the code.
Me~for other things.
That's all.
If you find any problems please comment.
Last edited by Takari; 03-31-2010 at 10:03 AM.
Golden. (06-12-2010),House (07-28-2010),karam98 (03-26-2011),Tony Stark` (02-17-2011)
Give credits on the autoclicker part.
Other, good job![]()
NextGen1 (03-31-2010)
NextGen1 (03-31-2010)
looks quite similar to the youtube video hu xD
give credits >_<

382
Agreed, USer is online, I will send him a VM

574
Yes,it's that video.
Sorry I will edit it with credits.
NextGen1 (03-31-2010)
Hmmm. It's not bad of a tutorial. You could have explained each block of code or at least done some commenting in the code itself for people new to VB. Example using this code:
Code:Public Class Form1 'Get keystate for hotkeys Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer 'Get envent for clicking Private Declare Sub mouse_event Lib "user32" (ByVal dwflags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cbuttons As Long, ByVal dwExtraInfo As Long) Private Const mouseclickup = 4 Private Const mouseclickdown = 2 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hotkeys.Tick 'Declare 'start' hotkey Dim Hotkey1 As Boolean 'Define 'start' hotkey as F5 Hotkey1 = GetAsyncKeyState(Keys.F5) 'If 'start' hotkey is pressed, start the clicks If Hotkey1 = True Then Clicks.Start() End If 'Declare 'stop' hotkey Dim Hotkey2 As Boolean 'Define 'stop' hotkey Hotkey2 = GetAsyncKeyState(Keys.F6) 'If 'stop' hotkey is pressed, stop clicking If Hotkey2 = True Then Clicks.Stop() End If End Sub Private Sub Click_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clicks.Tick 'Set interval(speed) of clicks to the number in the textbox Clicks.Interval = TextBox1.Text 'Click the mouse mouse_event(mouseclickdown, 0, 0, 0, 0) mouse_event(mouseclickup, 0, 0, 0, 0) End Sub End Class
Assembly Programmer
ubanooba (04-22-2010)

574
Mine has comments on it. Yours isn't commented or anything to help out new users understand what they are doing.
Assembly Programmer
Alroundeath (04-22-2010)
gj but leacher !!! ^^
GJ, nice and simple TUT. Its not leeching if its a tutorial really, just sharing it around![]()
wow if i was to post code now in this section i would NOT put comments it because most noobs are just going to copy paste it(which i do in some cases), and delete code from it that obviously they can fix b4 they can use my code so the comments are 1/4 useless(unless its a hard code to understand)(please note that was my opinion don't start to flame me).
![]()
nice job![]()
CANNIBAL CORPSE P0WNS
Sorry if this is reviving a dead topic but I copied the code you provided, it built fine but i started debugging and got these 3 errors:
A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll <--- this was repeated twice
A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll <---- also repeated twice
A first chance exception of type 'System.EntryPointNotFoundException' occurred in WindowsApplication1.exe
I'm using Microsoft Visual Basic 2008 Express Edition on Windows Vista-64bit if that helps.
Thanks