Código:
Declaración:
<System.Runtime.InteropServices.DllImport("user32")>
Private Shared Function GetAsyncKeyState(ByVal vkey As System.Windows.Forms.Keys) As Short
End Function
Public Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Integer,
ByVal hWndInsertAfter As Integer, ByVal X As Integer, ByVal Y As Integer)
Dim Count As Integer = 0
Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Private Const MouseClickUp = &H2
Private Const MouseClickDown = &H4
--------------------------------------------------------------------------------------------------------------------------------------------------
Timer1:
Windows.Forms.Cursor.Position = New Point(Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y)
LinkLabel1.Text = Windows.Forms.Cursor.Position.X
LinkLabel2.Text = Windows.Forms.Cursor.Position.Y
Timer1.Interval = NumericUpDown1.Value
Windows.Forms.Cursor.Position = New Point(TextBox1.Text, TextBox2.Text)
mouse_event(MouseClickUp, 0, 0, 0, 0)
mouse_event(MouseClickDown, 0, 0, 0, 0)
mouse_event(MouseClickUp, 0, 0, 0, 0)
mouse_event(MouseClickDown, 0, 0, 0, 0)
mouse_event(MouseClickUp, 0, 0, 0, 0)
mouse_event(MouseClickDown, 0, 0, 0, 0)
Windows.Forms.Cursor.Position = New Point(LinkLabel1.Text, LinkLabel2.Text)
--------------------------------------------------------------------------------------------------------------------------------------------------
Timer2:
Dim Tecla As Boolean
Tecla = GetAsyncKeyState(Keys.F1)
If Tecla = True Then Timer1.Start()
Dim Tecla1 As Boolean
Tecla1 = GetAsyncKeyState(Keys.F2)
If Tecla1 = True Then Timer1.Stop()
---------------------------------------------------------------------------------------------------------------------------------------------------
Timer3:
Dim SetPoint As Boolean
SetPoint = GetAsyncKeyState(Keys.F3)
If SetPoint = True Then TextBox1.Text = MousePosition.X : TextBox2.Text = MousePosition.Y