
Public Declare Function GetAsyncKeyState Lib "User32" (ByVal vKey As Long) As Integer
Dim HotkeyTrue as Boolean HotkeyTrue = GetAsyncKeyState(Keys.F12) 'F12 is the hotkey If HotkeyTrue = true Then Label1.Text = "True" End if
Dim HotkeyFalse as Boolean HotkeyFalse = GetAsyncKeyState(Keys.F11) 'F11 is the hotkey If HotkeyFalse = True Then Label1.Text = "False" End if
Public Class Form1
Public Declare Function GetAsyncKeyState Lib "User32" (ByVal vKey As Long) As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Hotkeyf12, hotkeyq As Boolean
Dim counter As Integer
Hotkeyf12 = GetAsyncKeyState(Keys.F12) 'F12 is the hotkey
hotkeyq = GetAsyncKeyState(Keys.Q)
If Hotkeyf12 = True Then
counter = (counter + 1)
Label1.Text = Str(counter)
Else
counter = counter
End If
If hotkeyq = True Then
Close()
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim counter As Integer = 0
Label1.Text = Str(counter)
Timer1.Enabled = True
End Sub
End Class