Idle Auto away
Posted: 2002-06-01
By: ArchiveBot
Viewed: 73
Filed Under:
No attachments for this post
this code show how to make an Auto Away like ICQ with Windows Api call GetLastInputInfo. Only work on Nt, 2000, and Xp not on 98,me...
Original Author: Frédéric Thibault
Assumptions
The value return to dwtime is the last time when the user move the mouse or use the keyboard. The time begin when the session is open.
Put a Timer and a textbox on a form. Name the textbox text1 and timer timer1 and copy and past this code.
Code
Private Type tagLASTINPUTINFO
cbSize As Long
dwTime As Long
End Type
Private Declare Function GetLastInputInfo Lib "user32" (ByRef LASTINPUTINFO As tagLASTINPUTINFO) As Long
Private Sub Timer1_Timer()
Dim mLast As tagLASTINPUTINFO
mLast.cbSize = Len(mLast)
Call GetLastInputInfo(mLast)
Me.Text1.Text = mLast.dwTime
End Sub
Comments on this post
No comments have been added for this post.
You must be logged in to make a comment.