Ok so the other day i was playing a game on facebook and decided to make a program to make it faster to play the game and save some time.
i made a simple auto clicker with some hotkeys to start/stop and then added some text boxes and some more hot keys to print what was in the textbox's
this was fine and i was happy with it till i seen this
http://www.youtube.com/watch?v=AlAASmyJ41g
now i want to make some thing like that but i want to use W,A,S,D keys to move the mouse around.
I am not sure how that guy made his but i want a way to make it and maybe even faster. so i can add it to my program.
here is my code for V1.2
Public Class FarmTownFarmer
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)
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub ClickOn_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClickOn.Tick
Dim ClickOn As Boolean
ClickOn = GetAsyncKeyState(Keys.F3)
If ClickOn = True Then
Clicker.Start()
End If
End Sub
Private Sub ClickOff_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClickOn.Tick
Dim ClickOff As Boolean
ClickOff = GetAsyncKeyState(Keys.F4)
If ClickOff = True Then
Clicker.Stop()
End If
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 Clicker_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clicker.Tick
MyMethod()
Clicker.Interval = SpeedSet.Text
End Sub
Private Sub SpeedTest_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SpeedTest.Click
Speed.Text = Speed.Text + 1
End Sub
Private Sub Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear.Click
Speed.Text = 0
End Sub
Private Sub MessHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MessHelp.Click
MsgBox("Welcome to message box Help" & vbNewLine & _
"The Message box system is easy to use." & vbNewLine & _
"Step 1 Enter text in 1 of the 4 boxes." & vbNewLine & _
"Step 2 Use your mouse to enter a" & vbNewLine & _
"place where you type text." & vbNewLine & _
"Step 3 Press The Key that is above the Box you." & vbNewLine & _
"Put the message in. (F5,F6,F7,F8).")
End Sub
Private Sub AutoHelp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox("Welcome to AutoClicker Help" & vbNewLine & _
"F3 & F4 start/stop the clicker." & vbNewLine & _
"You can set the speed buy changing." & vbNewLine & _
"the number after Click Every:" & vbNewLine & _
"Test the Click speed By holding mouse over" & vbNewLine & _
"the Speed Test Button" & vbNewLine & _
"Will work on any window at any speed")
End Sub
Private Sub Message1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Message1.Tick
Dim Message1 As Boolean
Message1 = GetAsyncKeyState(Keys.F5)
If Message1 = True Then
SendKeys.Send(Mess1.Text)
SendKeys.Send("{Enter}")
End If
End Sub
Private Sub Message2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Message1.Tick
Dim Message2 As Boolean
Message2 = GetAsyncKeyState(Keys.F6)
If Message2 = True Then
SendKeys.Send(Mess2.Text)
SendKeys.Send("{Enter}")
End If
End Sub
Private Sub Message3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Message1.Tick
Dim Message3 As Boolean
Message3 = GetAsyncKeyState(Keys.F7)
If Message3 = True Then
SendKeys.Send(Mess3.Text)
SendKeys.Send("{Enter}")
End If
End Sub
Private Sub Message4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Message1.Tick
Dim Message4 As Boolean
Message4 = GetAsyncKeyState(Keys.F8)
If Message4 = True Then
SendKeys.Send(Mess4.Text)
SendKeys.Send("{Enter}")
End If
End Sub
End Class
version V.1 never was finished because of the fail hot key system i was using was not global it was only working if you had the form active
there are alot of things in my code and on my form
4 buttons
6 textboxes
7 timers
so what i want to know is how can i find the mouse pos then do a load of math on it so that it moves the mouse over each square with in a range of the mouse.