Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Private Sub AFKDetect(ByVal sender As Object, ByVal e As EventArgs) ' Handles timerAFK.Tick
- ' Tiempo en minutos que hay que esperar para que se ponga en estado ausente
- If imputando Then
- Const AFKMinutes = 2000
- Static CpX As Integer
- Static CpY As Integer
- Static keyBefore As Char
- Static ExpiredTime
- If CpX = 0 Or CpY = 0 Then
- CpX = Cursor.Position.X
- CpY = Cursor.Position.Y
- End If
- If (CpX <> Cursor.Position.X) Or (CpY <> Cursor.Position.Y) Or (keyBefore <> keyPressed) Then
- ' Si son diferentes, entonces ponemos el contador a 0
- CpX = Cursor.Position.X
- CpY = Cursor.Position.Y
- keyBefore = keyPressed
- ExpiredTime = 0
- Else
- ' En el caso de que sean iguales, quiere decir que el cursor no se ha movido por lo que
- ' empezamos a contar
- ExpiredTime = ExpiredTime + timerAFK.Interval
- End If
- Dim ExpiredMinutes = ExpiredTime ' (ExpiredTime / 1000) / 60
- If ExpiredMinutes >= AFKMinutes And cuadroOff Then
- AfkorhereForm.StartPosition = FormStartPosition.CenterScreen
- AfkorhereForm.Width = 250
- AfkorhereForm.Height = 91
- Me.Enabled = False
- cuadroOff = False
- AfkorhereForm.Show()
- End If
- End If
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement