Solved

getting idle time from clients

Posted on 2004-10-22
220 Views
Last Modified: 2012-06-27
   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
Question by:Fubyou
    1 Comment
     
    LVL 4

    Accepted Solution

    by:


    '**************************************
    '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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Title # Comments Views Activity
    sum67 challenge 35 68
    has22 challenge 11 45
    NotAlone Challenge 20 56
    hasOne  challenge 59 45
    I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
    This is an explanation of a simple data model to help parse a JSON feed
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    875 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now