Results 1 to 11 of 11

Thread: How to check the idle time? (RESOLVED)

Threaded View

  1. #1

    Thread Starter
    Addicted Member AlvaroF1's Avatar
    Join Date
    Sep 2002
    Location
    SP - Brazil
    Posts
    200

    Question How to check the idle time? (RESOLVED)

    I used to use the following code to check the idle time on VB6:

    VB Code:
    1. Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
    2. Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
    3. Private Type POINTAPI
    4.     x As Long
    5.     y As Long
    6. End Type
    7. Private Sub Timer1_Timer()
    8.     Static lNotActive As Long
    9.     Static LastCursorPos As POINTAPI
    10.     lNotActive = lNotActive + 1
    11.     GetCursorPos CursorPos
    12.     If (CursorPos.x <> LastCursorPos.x) Or (CursorPos.y <> LastCursorPos.y) Then
    13.         LastCursorPos = CursorPos
    14.         lNotActive = 0
    15.     Else
    16.         For lCounter = 0 To 255
    17.             If GetAsyncKeyState(lCounter) > 0 Then lNotActive = 0
    18.         Next
    19.     End If
    20.     If lNotActive = 180 Then MsgBox "Idle time reached!"
    21. End Sub

    What about using VB. NET?


    Thank you.
    Last edited by AlvaroF1; Sep 14th, 2003 at 05:02 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width