getting idle time from clients

   I'm writing a program that needs to determine the idle time of a client (means no keyboard or mouse activity from user) in a lab of 20 computers. Using VB 6.0 or a script how could I do this?
FubyouAsked:
Who is Participating?
 
SicosCommented:


'**************************************
'Windows API/Global Declarations for :Sy
'     stem Idle Time
'**************************************


Private Type PLASTINPUTINFO
    cbSize As Long
    dwTime As Long
    End Type


Private Declare Function GetLastInputInfo Lib "user32.dll" (plii As PLASTINPUTINFO) As Long


Private Declare Function GetTickCount Lib "kernel32" () As Long
'**************************************
' Name: System Idle Time
' Description:This will give you the sys
'     tem idle time without using timers and s
'     tuff that constantly monitor the system
'     using API's like GetAsyncKeystate or Get
'     CursorPos. This uses the GetLastInputInf
'     o API function, returning the time the l
'     ast input happend. You it together with
'     GetTickCount gets you the system idle ti
'     me
' By: Cakkie
'
'
' Inputs:None
'
' Returns:None
'
'Assumes:None
'
'Side Effects:Works only on Win2K+ (no W
'     in95/98, sorry)
'**************************************

Dim PI As PLASTINPUTINFO

PI.cbSize = Len(PI)



If GetLastInputInfo(PI) <> 0 Then
    Label1.Caption = "System idle time: " & GetTickCount - PI.dwTime
Else
    Label1.Caption = "Function call failed"
End If


Greetings,
Sicos
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.