-
Plz helllp me!!!
As the title says, so far I've made a program that can move the cursor automatically.
But I also want it to "click" as well automatically.
e.g. imagine the current form and the mouse cursor moving out to the "Start" button and clicks...
H E L P
Thankyou
-
Easy as pie.
Code:
'Place these lines in a module:
Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Public Const MOUSEEVENTF_ABSOLUTE = &H8000 'Exact Coordinates
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
Public Const MOUSEEVENTF_MIDDLEUP = &H40
Public Const MOUSEEVENTF_MOVE = &H1 'Move from where cursor is now
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10
Public Const MOUSEEVENTF_WHEEL = &H80
Public Const MOUSEEVENTF_XDOWN = &H100
Public Const MOUSEEVENTF_XUP = &H200
Public Const WHEEL_DELTA = 120
Public Const XBUTTON1 = &H1
'Place this where you want to execute the code.
mouse_event MOUSEEVENTF_MOVE Or MOUSEEVENTF_ABSOLUTE, 120, 120, 0, 0
' Press and then release the left mouse button.
mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0
Public Const XBUTTON2 = &H2
Remember that the coordinates you enter are in PIXELS, not TWIPS!