Hotkeys
I wanted to add hotkeys to my program (f7 to start, f8 to stop)
the program is a tapper.
this is my code:
I tried, and if i don't press anything, it already does what it has to do when i press f7.
the program is a tapper.
this is my code:
Code:
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
Dim starthotkey As Boolean
starthotkey = GetAsyncKeyState(Keys.F7)
Dim stophotkey As Boolean
stophotkey = GetAsyncKeyState(Keys.F8)
If starthotkey = True Then
If TextBox1.Text = "" Then
Timer3.Stop()
MsgBox("To Prevent Host Failure, Start the game first.")
Timer4.Start()
Else
Shell("cmd.exe /c ipconfig/release")
Button1.Text = "Connect (F8)"
End If
Else
Timer4.Stop()
End If
If stophotkey = True Then
Timer3.Stop()
Shell("cmd.exe /c ipconfig/renew")
Button1.Text = "Disconnect (F7)"
Timer4.Start()
Else
Timer4.Stop()
End If
End Sub
Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
Timer4.Stop()
Timer3.Start()
End Sub


![=]](/forum/images/emotions/=].gif)