Session / UserActivity

CHAT --> AFK-Erkennung
This commit is contained in:
2022-11-22 22:39:35 +01:00
parent 4b9d6db10b
commit d9b13ba8fb
4 changed files with 55 additions and 7 deletions

View File

@@ -0,0 +1,25 @@
Imports System.Runtime.InteropServices
Public Class cUserActivity
Declare Function GetLastInputInfo Lib "user32" (ByRef plii As LASTINPUTINFO) As Boolean
'Private WithEvents T As New Timer With {.Interval = 1000, .Enabled = True}
Structure LASTINPUTINFO
Public cbSize As Integer
Public dwTime As Integer
End Structure
Shared Function GetLastInputTime_Seconds() As Integer
Static LastInput As New LASTINPUTINFO()
LastInput.cbSize = Marshal.SizeOf(LastInput)
LastInput.dwTime = 0
GetLastInputInfo(LastInput)
Return (Environment.TickCount - LastInput.dwTime) / 1000
End Function
Shared Function GetLastInputTime_Minutes() As Integer
Return GetLastInputTime_Seconds() / 60
End Function
'Private Sub T_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles T.Tick
' Me.Text = "Letzte Aktivität vor " & GetLastInputTime() & " Sek."
'End Sub
End Class