Results 1 to 12 of 12
  1. #1
    Iamazn's Avatar
    Join Date
    Dec 2008
    Gender
    male
    Posts
    141
    Reputation
    10
    Thanks
    85

    [TuT]How to Register a HotKey

    Add this right after "Public Class Form1"

    Code:
    Public Const MOD_ALT As Integer = &H1 'Alt key
    
        Public Const WM_HOTKEY As Integer = &H312
    
    
        Public Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
    
        Public Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer) As Integer
    
        Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    
            If m.Msg = WM_HOTKEY Then
                Dim id As IntPtr = m.WParam
                Select Case (id.ToString)
                    Case "9"
                       'Code here
                 End Select
            End If
            MyBase.WndProc(m)
        End Sub
    
        Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
    
            Call UnregisterHotKey(Me.Handle, 9)
            Call UnregisterHotKey(Me.Handle, 10)
    
        End Sub

    Add this to the Form Loading

    Code:
    Call RegisterHotKey(Me.Handle, 9, MOD_ALT, Keys.C)
    'Replace Keys.C with the Hotkey you want
    The hotkey will work even if form isnt in focus, aka it will work ingame.

  2. The Following 4 Users Say Thank You to Iamazn For This Useful Post:

    CounterAct (11-14-2009),FlashDrive (12-07-2009),Pixie (10-02-2009),XGelite (10-12-2009)

  3. #2
    Tierrize's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    C:\MPGH\General
    Posts
    1,020
    Reputation
    -6
    Thanks
    90
    My Mood
    Amused
    Good Job Bro
    [IMG]https://i324.photobucke*****m/albums/k357/Win32Trojan/Untitled-1-4.gif[/IMG][IMG]https://i324.photobucke*****m/albums/k357/Win32Trojan/Untitled-1-4.gif[/IMG][IMG]https://i324.photobucke*****m/albums/k357/Win32Trojan/Untitled-1-4.gif[/IMG]

    Hazedup is the best there ever was

  4. #3
    XGelite's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Enter text here
    Posts
    1,344
    Reputation
    12
    Thanks
    276
    Thanks man

    only it doesnt work in VB08
    Last edited by XGelite; 10-12-2009 at 03:52 PM.

  5. #4
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,404
    Reputation
    157
    Thanks
    4,003
    My Mood
    Flirty
    didnt work

  6. #5
    Iamazn1's Avatar
    Join Date
    Oct 2009
    Gender
    male
    Posts
    407
    Reputation
    12
    Thanks
    50
    Quote Originally Posted by ac1d_buRn View Post
    didnt work
    It should.
    -What version of VB you use?
    -Any errors?

  7. #6
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,404
    Reputation
    157
    Thanks
    4,003
    My Mood
    Flirty
    Quote Originally Posted by Iamazn1 View Post
    It should.
    -What version of VB you use?
    -Any errors?
    VB 2008
    No errors. But how do i make it start my program?

  8. #7
    linuxandmegasrulz's Avatar
    Join Date
    Nov 2008
    Gender
    male
    Posts
    374
    Reputation
    11
    Thanks
    54
    My Mood
    Amused
    Omg no workin vb......Sorry i dont know vb....i only know c++

    Mr.Anderson.................

  9. #8
    iownageXD's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Australia
    Posts
    1,231
    Reputation
    61
    Thanks
    179
    My Mood
    Angelic
    Eh, this one has more complicated coding than it needs.. >_>
    I got an easier code =3

  10. #9
    User1's Avatar
    Join Date
    Jul 2009
    Gender
    female
    Location
    Above the influence
    Posts
    4,065
    Reputation
    61
    Thanks
    4,294,967,295
    My Mood
    Crappy
    GetAsyncState Much?! God it is a hella lot easier than that shit
    Any donations would help


    Quote Originally Posted by Bombsaway707

    HOLY SHIT ITS USER1
    Quote Originally Posted by Blood

    HOLY SHIT ITS USER1
    Quote Originally Posted by Alby-kun


    HOLY SHIT ITS USER1
    Quote Originally Posted by Ali

    HOLY SHIT ITS USER1
    Quote Originally Posted by CodeDemon
    HOLY SHIT ITS USER1
    Quote Originally Posted by Jussofresh View Post
    HOLY SHIT ITS USER1!
    [21:13] CoderNever: HOLY SHIT ITS USER1!

  11. #10
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,404
    Reputation
    157
    Thanks
    4,003
    My Mood
    Flirty
    Quote Originally Posted by User1 View Post
    GetAsyncState Much?! God it is a hella lot easier than that shit
    User1, Do you think you could please teach me how to do it?

  12. #11
    ac1d_buRn's Avatar
    Join Date
    Aug 2009
    Gender
    female
    Location
    CA Source Section
    Posts
    3,404
    Reputation
    157
    Thanks
    4,003
    My Mood
    Flirty
    Wait i got it.
    But again. When i let go of the key. The prgram stops.
    Can someone please help me stop this?

    I WANT IT TO STAY ON!!!

  13. #12
    muted101's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Posts
    7
    Reputation
    10
    Thanks
    0
    My Mood
    Dead

    Thumbs down

    Quote Originally Posted by Tierrize View Post
    Good Job Bro
    racist obama hater

Similar Threads

  1. [Video TUT]How to make hotkeys in visualbasic08
    By trevor206 in forum Visual Basic Programming
    Replies: 7
    Last Post: 10-10-2009, 03:08 PM
  2. [Tut]How to REALLY be Invisible
    By EndRiT in forum WarRock - International Hacks
    Replies: 8
    Last Post: 04-24-2007, 09:13 AM
  3. [tut]how to have lots of nades
    By damanis1 in forum WarRock - International Hacks
    Replies: 20
    Last Post: 04-22-2007, 07:51 AM
  4. [Tut]How to become invisible
    By EndRiT in forum WarRock - International Hacks
    Replies: 24
    Last Post: 04-21-2007, 05:02 PM
  5. Tut: how to make cheese
    By ace76543 in forum General
    Replies: 14
    Last Post: 01-14-2007, 09:39 AM

Tags for this Thread