Hierfür folgende Codeparts in das Projekt eingefügt werden:
Code: Alles auswählen
Private Structure inputInfo
Public cbSize As Int32
Public dwTime As Int32
End Structure
Private Declare Function GetLastInputInfo Lib "user32.dll" (ByRef plii As inputInfo) As Boolean
Function getIDLE() As UInt32
Dim info As inputInfo
info.cbSize = Len(info)
GetLastInputInfo(info)
Dim idleTime As UInt32 = (Environment.TickCount - info.dwTime)
Return idleTime
End Function
Code: Alles auswählen
getIDLE()