Computer Science Canada

Is there a way to force your mouse to move?

Author:  HazySmoke)345 [ Fri Nov 18, 2005 5:08 pm ]
Post subject:  Is there a way to force your mouse to move?

Such as, forcing it to move and click somewhere and such using a program. Is it possible to code it with VB?

Author:  [Gandalf] [ Fri Nov 18, 2005 7:08 pm ]
Post subject: 

Not sure about VB, but it is highly possible using macros. Look them up on google and you will find everything you need.

Author:  Brightguy [ Fri Nov 18, 2005 10:30 pm ]
Post subject:  Re: Is there a way to force your mouse to move?

Play around with SetCursorPos and mouse_event. Here's the basic outline to get you started:

VisualBASIC:
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

Private Const MOUSEEVENTF_LEFTDOWN = &H2
Private Const MOUSEEVENTF_LEFTUP = &H4

Private Sub SimulateClick(x As Long, y As Long)
    SetCursorPos x, y
    mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, 0&, 0&, 0&, 0&
End Sub


: