|
-
Jan 11th, 2005, 11:16 PM
#1
Thread Starter
Addicted Member
Mouse Movement
hi
i want to knw that three has been no mouse movents or no key strokes for a particular interval lets say 2 minutes, in other words i want to knw if system remain idle for this interval ...
-
Jan 11th, 2005, 11:26 PM
#2
Re: Mouse Movement
you could use a timer, but you'd have to start it.
-
Jan 11th, 2005, 11:29 PM
#3
Thread Starter
Addicted Member
Re: Mouse Movement
hey wat do u mean by that ... pls elaborate !
-
Jan 11th, 2005, 11:29 PM
#4
Re: Mouse Movement
It's not as simple as it may sounds - system wide hook will need to be created if you want it to work "properly".
If you want to get an idea of how complicated this could be - take alook at this sample project from vbaccelerator .
Good luck.
-
Jan 12th, 2005, 12:07 AM
#5
Thread Starter
Addicted Member
Re: Mouse Movement
well i also found some module code to get mouse n key strokes n it said that use a timer to control its timings now, i tried using timer with 10 seconds interval but i think it does not return proper value. here is da code
Option Explicit
Private Type POINTAPI
x As Integer
y As Integer
End Type
Private Declare Sub GetCursorPos Lib "user32.dll" (lpPoint As POINTAPI)
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Long) As Integer
Private posOld As POINTAPI
Private posNew As POINTAPI
'------------------------------
'Now create a new function in MoveDetect
'-------------------------------
Public Function InputCheck() As Boolean
Dim i As Integer
'Get the current mouse cursor coordinates
Call GetCursorPos(posNew)
'Compare with old coordinates
If ((posNew.x <> posOld.x) Or (posNew.y <> posOld.y)) Then
posOld = posNew
InputCheck = True
Exit Function
End If
'Check keys state
For i = 0 To 255
If (GetAsyncKeyState(i) And &H8001) <> 0 Then
InputCheck = True
Exit Function
End If
Next i
InputCheck = False
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|