[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 230
  • Last Modified:

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?
0
Fubyou
Asked:
Fubyou
1 Solution
 
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now