VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Idle Auto away

by Frédéric Thibault (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

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...

Assumes
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.

Rate Idle Auto away

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

Download this snippet    Add to My Saved Code

Idle Auto away Comments

No comments have been posted about Idle Auto away. Why not be the first to post a comment about Idle Auto away.

Post your comment

Subject:
Message:
0/1000 characters