Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Runtime.InteropServices
- Class KeyChecker
- Public Event HandleKeyPersed(ByVal vKey As System.Windows.Forms.Keys)
- Dim KeysToHandle As New ArrayList
- <DllImport("user32.dll")>
- Shared Function GetAsyncKeyState(ByVal vKey As System.Windows.Forms.Keys) As Short
- End Function
- Sub Start()
- Dim T As New Threading.Thread(Sub()
- While True
- For Each xKey As System.Windows.Forms.Keys In KeysToHandle
- If GetAsyncKeyState(xKey) > 0 Then
- RaiseEvent HandleKeyPersed(xKey)
- End If
- Next
- Threading.Thread.Sleep(700)
- End While
- End Sub) With {.IsBackground = True} : T.Start()
- End Sub
- Sub HandleThisKey(ByVal Key As System.Windows.Forms.Keys)
- KeysToHandle.Add(Key)
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement