Does anybody know of a way to determine if the mouse has been moved even when the application that is checking mouse movement is minimized.
i.e. a program that determines when the mouse has been moved when the user is using another program?
Printable View
Does anybody know of a way to determine if the mouse has been moved even when the application that is checking mouse movement is minimized.
i.e. a program that determines when the mouse has been moved when the user is using another program?
I have seen such a thing coded using API's. Try asking there. I will have a look for you and post soon, but hope this is a pointer for you in the meantime.
Try this. Make a Form with a Timer and put the following code into your Form.
Code:Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal X As Long, ByVal Y As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Dim CurPos As POINTAPI
Dim OldX As Single
Dim OldY As Single
Private Sub Form_Load()
Timer1.Interval = 10
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
'The the coordinates of the Mouse
Retval = GetCursorPos(CurPos)
X = CurPos.X
Y = CurPos.Y
If OldX = X And OldY = Y Then
'The mouse is still
Else
'the Mouse has moved
OldX = X
OldY = Y
Beep
End If
End Sub