Ok i have an issue here. I got the mouse moving but it refuses to click no matter what way i approach the code.
I would use the bitmap option but not sure how to use them just yet.
Atm i have it moving to the back to deck button.
the code im using for Cursor.Position is very simple.
-------------------------------------------------------------------------------------------------------------------------------------------
code
-------------------------------------------------------------------------------------------------------------------------------------------
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Cursor.Position = New Point(900, 410)
End Sub
End Class
--------------------------------------------------------------------------------------------------------------------------------------------
I want it to be able to click after moved and then wait 30 seconds and then click on the station to restation. so ill have to add a timer and stuff. This will be my first bot so i would like to do it right.
--------------------------------------------------------------------------------------------------------------------------------------------
Add me skype: Sarcasm.bs
If you would rather just put it in comments thats fine also.
- - - Updated - - -
Forgot to mention that i have this.
Public Class Form1
Private WithEvents Button1 As New Button
<Flags()> _
Private Enum MouseEvents As UInteger
MOUSEEVENTF_MOVE = &H1
MOUSEEVENTF_LEFTDOWN = &H2
MOUSEEVENTF_LEFTUP = &H4
MOUSEEVENTF_RIGHTDOWN = &H8
MOUSEEVENTF_RIGHTUP = &H10
MOUSEEVENTF_MIDDLEDOWN = &H20
MOUSEEVENTF_MIDDLEUP = &H40
MOUSEEVENTF_ABSOLUTE = &H8000
End Enum
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As MouseEvents, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Sub New()
InitializeComponent()
Me.Controls.Add(Button1)
Button1.Text = "Go"
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Define a point that is probably near the start button.
Dim pointToClick As Point
pointToClick.X = 20
pointToClick.Y = Screen.PrimaryScreen.Bounds.Height - 20
' Move the mouse cursor. I'm not using the api. If you use the API you need
' to use MOUSEEVENTF_ABSOLUTE and normalize the point to a screen that has
' 0,0 at the top left and (65535,65535) at the lower right.
Windows.Forms.Cursor.Position = pointToClick
' And click.
mouse_event(MouseEvents.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MouseEvents.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------
But this does not move the mouse like a person.
I would use the bitmap option but not sure how to use them just yet.
Atm i have it moving to the back to deck button.
the code im using for Cursor.Position is very simple.
-------------------------------------------------------------------------------------------------------------------------------------------
code
-------------------------------------------------------------------------------------------------------------------------------------------
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Cursor.Position = New Point(900, 410)
End Sub
End Class
--------------------------------------------------------------------------------------------------------------------------------------------
I want it to be able to click after moved and then wait 30 seconds and then click on the station to restation. so ill have to add a timer and stuff. This will be my first bot so i would like to do it right.
--------------------------------------------------------------------------------------------------------------------------------------------
Add me skype: Sarcasm.bs
If you would rather just put it in comments thats fine also.
- - - Updated - - -
Forgot to mention that i have this.
Public Class Form1
Private WithEvents Button1 As New Button
<Flags()> _
Private Enum MouseEvents As UInteger
MOUSEEVENTF_MOVE = &H1
MOUSEEVENTF_LEFTDOWN = &H2
MOUSEEVENTF_LEFTUP = &H4
MOUSEEVENTF_RIGHTDOWN = &H8
MOUSEEVENTF_RIGHTUP = &H10
MOUSEEVENTF_MIDDLEDOWN = &H20
MOUSEEVENTF_MIDDLEUP = &H40
MOUSEEVENTF_ABSOLUTE = &H8000
End Enum
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As MouseEvents, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Sub New()
InitializeComponent()
Me.Controls.Add(Button1)
Button1.Text = "Go"
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Define a point that is probably near the start button.
Dim pointToClick As Point
pointToClick.X = 20
pointToClick.Y = Screen.PrimaryScreen.Bounds.Height - 20
' Move the mouse cursor. I'm not using the api. If you use the API you need
' to use MOUSEEVENTF_ABSOLUTE and normalize the point to a screen that has
' 0,0 at the top left and (65535,65535) at the lower right.
Windows.Forms.Cursor.Position = pointToClick
' And click.
mouse_event(MouseEvents.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MouseEvents.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
End Sub
End Class
-------------------------------------------------------------------------------------------------------------------
But this does not move the mouse like a person.
Comment