How to check the idle time? (RESOLVED)
I used to use the following code to check the idle time on VB6:
VB Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Timer1_Timer()
Static lNotActive As Long
Static LastCursorPos As POINTAPI
lNotActive = lNotActive + 1
GetCursorPos CursorPos
If (CursorPos.x <> LastCursorPos.x) Or (CursorPos.y <> LastCursorPos.y) Then
LastCursorPos = CursorPos
lNotActive = 0
Else
For lCounter = 0 To 255
If GetAsyncKeyState(lCounter) > 0 Then lNotActive = 0
Next
End If
If lNotActive = 180 Then MsgBox "Idle time reached!"
End Sub
What about using VB. NET?
Thank you.
Re: How to check the idle time? (RESOLVED)
Quote:
Originally Posted by Evad
Yes, it should. test it out.
NO IT DOESNT, TRIED IT 5 MIN. Ago
Re: How to check the idle time? (RESOLVED)
How can One Use the System Idle Process - Its there when you press CTRL+ALT+DEL.
Re: How to check the idle time? (RESOLVED)
Quote:
Originally Posted by Codehammer
How can One Use the System Idle Process - Its there when you press CTRL+ALT+DEL.
Examining the Code, its only Checking for a mousemove event, the Program Will Work if I use a Txtchanged even, but only if the program is in Focus.
Any Ideas