Adding Hotkeys to VB Projects.

Posts 1–10 of 10 · Page 1 of 1
Adding Hotkeys to VB Projects.
Hello. I'm making a tapper. And a multi-tool soon. I need to know the code to make a hotkey to represent a "Shell "DHCP STOP"" or any control for that matter.
-Thanks in advance.
Code:
Public Class Form1
    Private 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 StartHotkey As Integer
        StartHotkey = GetAsyncKeyState(120)
        If StartHotkey <> 0 Then
            Shell("NET STOP DHCP")
        End If
        Dim StopHotkey As Integer
        StopHotkey = GetAsyncKeyState(121)
        If StopHotkey <> 0 Then
            Shell("NET START DHCP")
        End If
    End Sub
    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
        Process.Start("http://www.mpgh.net")
    End Sub
End Class
That's the way to do it. Press thanks remember!!!
Thanks.
No problem. Just make sure the timer interval is about 500 and don't hold down the hotkey.
then F9 = 120

F10 = 121???


StartHotkey = GetAsyncKeyState(120)

StopHotkey = GetAsyncKeyState(121)
??
Quote Originally Posted by fly777 View Post
then F9 = 120

F10 = 121???


??
Yep, that's it.

I just read up those numbers somewhere and it confuses leeching choobs. XD
Or
GetAsyncKeyState (Keys.F9)
Instead of Key Numbers.
thank you too much
No problemo. But it would help if you pressed the button too, then I can do more of this.
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

Talk with us