[source]
Imports System.Threading
Public Class Form1
'handles mouse cursor position
Private Declare Sub SetCursorPos Lib "User32" (ByVal x As Integer, ByVal y As Integer)
'mouse click events
Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4
Private Const MOUSEEVENTF_RIGHTDOWN = &H8
Private Const MOUSEEVENTF_RIGHTUP = &H10
Private Declare Sub mouse_event Lib "User32" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Dim t1 As Thread
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TopMost = True 'make form on top of all windows
Me.CheckForIllegalCrossThreadCalls = False
'start the timer
TimerInt.Start()
End Sub
'sub called from timer
Private Sub mousepos()
xpos.Text = "X: " & MousePosition.X 'get mouse x co-ordinate point
ypos.Text = "Y: " & MousePosition.Y 'get mouse y co-ordinate point
End Sub
Private Sub btnClick_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClick.Click
t1 = New System.Threading.Thread(AddressOf clickit)
t1.Start() 'start the sub routing
End Sub
Private Sub clickit()
Dim xloc, yloc, bxloc, byloc As Integer 'variable to store mouse positions
xloc = txtx.Text 'get x-loc for head
yloc = txty.Text 'get y-loc for head
bxloc = bpx.Text 'get x-lo for barrel
byloc = bpy.Text 'get y-lo for barrel
'move mouse to gun barrel
Windows.Forms.Cursor.Position = New Point(bxloc, byloc)
'wait for countdown [vary tune to your choice] in ms
System.Threading.Thread.Sleep(1889)
'move mouse to the opponents head
Windows.Forms.Cursor.Position = New Point(xloc, yloc)
'click two time - 1 to focus the window, next to shoot
For i = 0 To 2
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Next
End Sub
'start timer
Private Sub TimerInt_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerInt.Tick
mousepos()
End Sub
End Class
Ещё видео!