Mouse Clicking [solved]
OK so last night was the first time i ever even looked at visual basic code so please take it easy on me. I am trying to make a very basic boxing bot for the game dark orbit just to learn basics. So far i am able to wright code to make the cursor move but i can't get it to click where it stops. Can any one give me a hand??
[highlight="VB.Net"]Public 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)
Public Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Public Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Public Sub SimulateClick()
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub[/highlight]
Execute the SimluateClick Sub after moving your mouse.
[highlight="VB.Net"]SimulateClick()[/highlight]
I'm not using a timer. It moves the cursor to the spot i need it to go when i click the start button. But the problem is i need it to click on that spot it moved the cursor to and i can not figure out how to do that. Sorry for the confusion should of worded it better.
You are not executing the sub.
[highlight="VB.Net"]Public Class Form1
Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.Cursor = New Cursor(Cursor.Current.Handle)
Cursor.Position = New Point(Cursor.Position.X + 751, Cursor.Position.Y + 296)
SimulateClick()
End Sub
Public 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)
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Sub SimulateClick()
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
End Class[/highlight]