Private Declare Function GetLastInputInfo Lib "user32" (ByRef plii As LASTINPUTINFO) As Boolean Private Declare Function GetTickCount Lib "kernel32" () As Int32 Private Sub frmAutoLogout_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim tim As New Timer tim.Interval = 200 AddHandler tim.Tick, AddressOf tim_Tick tim.Start() End Sub Private Sub tim_Tick(ByVal sender As Object, ByVal e As EventArgs) Dim lii As LASTINPUTINFO lii.cbSize = Len(lii) GetLastInputInfo(lii) lblCountdown.Text = "You have (secs): " & ((GetTickCount() - lii.dwTime) / 1000.0).ToString End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)