Hi Friends,
I am trying to capture system idle time using visual basic applications and i got code from below mention url also i have uplode my question on below link
Vba code as per below
Private Type LASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Private Declare Sub GetLastInputInfo Lib "user32" (ByRef plii As LASTINPUTINFO)
Private Declare Function GetTickCount Lib "kernel32" () As Long
Function IdleTime() As Single
Dim a As LASTINPUTINFO
a.cbSize = LenB(a)
GetLastInputInfo a
IdleTime = (GetTickCount - a.dwTime) / 1000
End Function
Sub PrintIdleTime1()
Debug.Print IdleTime
Application.OnTime Now + TimeSerial(0, 0, 5), "PrintIdleTime2"
End Sub
Sub PrintIdleTime2()
Debug.Print IdleTime
Application.OnTime Now + TimeSerial(0, 0, 5), "PrintIdleTime1"
I want idle time in HH:MM:SS format and it should be like below
Idle start time Idle end Time Idle total time
12:00:00 12:45:00 00:45:00
URL : http://www.mrexcel.com/forum/excel-ques ... ost4303599