Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. Private Sub AFKDetect(ByVal sender As Object, ByVal e As EventArgs) ' Handles timerAFK.Tick
  2. ' Tiempo en minutos que hay que esperar para que se ponga en estado ausente
  3. If imputando Then
  4.  
  5.  
  6. Const AFKMinutes = 2000
  7.  
  8. Static CpX As Integer
  9. Static CpY As Integer
  10. Static keyBefore As Char
  11. Static ExpiredTime
  12.  
  13. If CpX = 0 Or CpY = 0 Then
  14. CpX = Cursor.Position.X
  15. CpY = Cursor.Position.Y
  16. End If
  17.  
  18. If (CpX <> Cursor.Position.X) Or (CpY <> Cursor.Position.Y) Or (keyBefore <> keyPressed) Then
  19. ' Si son diferentes, entonces ponemos el contador a 0
  20. CpX = Cursor.Position.X
  21. CpY = Cursor.Position.Y
  22. keyBefore = keyPressed
  23. ExpiredTime = 0
  24. Else
  25. ' En el caso de que sean iguales, quiere decir que el cursor no se ha movido por lo que
  26. ' empezamos a contar
  27. ExpiredTime = ExpiredTime + timerAFK.Interval
  28. End If
  29.  
  30. Dim ExpiredMinutes = ExpiredTime ' (ExpiredTime / 1000) / 60
  31. If ExpiredMinutes >= AFKMinutes And cuadroOff Then
  32. AfkorhereForm.StartPosition = FormStartPosition.CenterScreen
  33. AfkorhereForm.Width = 250
  34. AfkorhereForm.Height = 91
  35. Me.Enabled = False
  36. cuadroOff = False
  37. AfkorhereForm.Show()
  38. End If
  39. End If
  40. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement