I figured out my self
Old code:
vb Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim starthotkey As Boolean
Dim stophotkey As Boolean
starthotkey = GetAsyncKeyState(Keys.F3)
stophotkey = GetAsyncKeyState(Keys.F4)
If starthotkey = True Then
'start
Timer1.Enabled = True
If stophotkey = True Then
'stop
Timer1.Enabled = False
End If
End If
End Sub
New code:
vb Code:
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim starthotkey As Boolean
Dim stophotkey As Boolean
starthotkey = GetAsyncKeyState(Keys.F3)
stophotkey = GetAsyncKeyState(Keys.F4)
If starthotkey = True Then
'start
Timer1.Enabled = True
End if
If stophotkey = True Then
'stop
Timer1.Enabled = False
End If
End Sub