Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Invidus's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    2,167
    Reputation
    23
    Thanks
    650
    My Mood
    Bored

    [Tutorial]Global Hotkey

    Hey guys, this tutorial is leeched. I found an excellent website that contains it, and edited it. To see the original Tutorial, go here

    This tutorial will explain how to make a hotkey function which works when the form is unfocused, hence, the name : Global Hotkey.

    Firstly, you need to declare the GetAsyncKeyState API. To do this, type in this in the code:
    [php]Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer[/php]So now, we'll want our program to check if the hotkeys are being pressed. We want it to check frequently so we can have an immediate reaction when the hotkey is pressed.

    Add a timer. Double click on the Form. It should come up with the Form1.Load event.
    Type this in:
    [php]Timer1.enabled = true
    Timer1.interval = 1[/php]

    This sets the Timer's Interval to 1, and having it enabled. Now , we need the hotkey you want
    pressed.

    If you want 3 hotkeys to be pressed for your "whatever it is you need hotkeys for" to be
    activated, then you'll need to declare 3 booleans in the Timer1.Tick Event.
    For e.g. Ctrl+Alt+K. They can be called whatever you want.
    [php]
    Dim ctrl As Boolean
    Dim alt As Boolean
    Dim k As Boolean[/php]

    When you have done that, you need to set their value.
    We will use Ctrl-Alt-k again.

    [php]ctrl = GetAsyncKeyState(Keys.ControlKey)
    alt = GetAsyncKeyState(Keys.Menu)
    k = GetAsyncKeyState(Keys.K)
    [/php]

    Now, an If Statement to check whether the keys have been pressed.

    If ctrl And alt And k = True Then

    'Put here the code that will initiate when the keys are pressed. E.g Timer2.Start
    or Button1.Enabled

    end if

    So here is our final code:

    [php]Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    Timer1.enabled = true
    Timer1.interval = 1

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

    Dim ctrl As Boolean
    Dim alt As Boolean
    Dim k As Boolean

    ctrl = GetAsyncKeyState(Keys.ControlKey)
    alt = GetAsyncKeyState(Keys.Menu)
    k = GetAsyncKeyState(Keys.K)

    If ctrl And alt And k = True Then
    '
    'Put here the code that will initiate when the keys are pressed. E.g Timer2.Start
    or Button1.Enabled

    end if
    End Class[/php]

    Hope it worked for you! That was just an example. You can have as many
    or as short hotkeys as you want. Just edit the sample code above.
    E.g. if you wanted 2 hotkeys:

    [php]Dim blaa As Boolean
    Dim waaa As Boolean

    blaa= GetAsyncKeyState(Keys.B)
    waaa = GetAsyncKeyState(Keys.W)

    if blaa and waaa = true then

    'Here is the code that runs again'

    end if
    [/php]



    *A Handy Few Notes from CodingIlliterate

    Any Button on your keyboard like Control, Shift etc. is
    (Keys.ControlKey)
    not
    (Keys.Control)

    I also spent lots of time searching for the Alt Key.

    The Alt Key is

    (Keys.Menu)

    Thanks for Reading! Hope it helped and if you liked it, press thanks!
    Last edited by Invidus; 03-28-2010 at 08:40 PM.

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

    MJLover (03-29-2010),NextGen1 (03-28-2010)

  3. #2
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Thanks for sharing, Looks good


     


     


     



    The Most complete application MPGH will ever offer - 68%




  4. #3
    Invidus's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    2,167
    Reputation
    23
    Thanks
    650
    My Mood
    Bored
    Thanks NextGen! I hope it helps those who do not know how to use hotkeys, and those who do, to learn about Global Hotkeys.

  5. #4
    D3Dh0oker's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Location
    Snow vally
    Posts
    1,850
    Reputation
    8
    Thanks
    438
    My Mood
    Angelic
    ima leech this from u >=) jk thanks it will make spammers and tappers 10+ easyer

  6. #5
    Invidus's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    2,167
    Reputation
    23
    Thanks
    650
    My Mood
    Bored
    Hhehe. NextGen can you put this in your list of TuTs?? Pweeze =D

  7. #6
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    I will add it soon


     


     


     



    The Most complete application MPGH will ever offer - 68%




  8. #7
    Invidus's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    2,167
    Reputation
    23
    Thanks
    650
    My Mood
    Bored
    ok thanks nextgen

  9. #8
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Wasn't this posted multiple times?



  10. #9
    MJLover's Avatar
    Join Date
    Feb 2010
    Gender
    male
    Location
    Neverland
    Posts
    759
    Reputation
    33
    Thanks
    110
    My Mood
    Cheerful
    Thanks for sharing buddy. Very helpful

  11. #10
    Invidus's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    2,167
    Reputation
    23
    Thanks
    650
    My Mood
    Bored
    Quote Originally Posted by Blubb1337 View Post
    Wasn't this posted multiple times?
    Really? Didn't know that.

  12. #11
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    Yea seen it a few times on mpgh, thanks for sharing though



  13. #12
    Invidus's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    2,167
    Reputation
    23
    Thanks
    650
    My Mood
    Bored
    =P. Thanks Blubb. Anyway i didn't leech it from previous posters. I just found a good website and decided it to share info with yooh guys!

  14. #13
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    I'm thinking about doing an advanced trainer tutorial but idk



  15. #14
    Invidus's Avatar
    Join Date
    Jan 2010
    Gender
    male
    Posts
    2,167
    Reputation
    23
    Thanks
    650
    My Mood
    Bored
    For MWF2? /too short

  16. #15
    Blubb1337's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Germany
    Posts
    5,915
    Reputation
    161
    Thanks
    3,108
    generally for all games



Page 1 of 2 12 LastLast

Similar Threads

  1. [Help] Global Hotkey [Solved]
    By karldeovbnet in forum Visual Basic Programming
    Replies: 6
    Last Post: 03-03-2011, 07:28 AM
  2. [Tutorial]AntiMute Spammer [Leeched]
    By aLcohoL_95 in forum Visual Basic Programming
    Replies: 5
    Last Post: 03-24-2010, 10:31 PM
  3. [Help]Easy Global hotkeys[Solved]
    By jaake in forum Visual Basic Programming
    Replies: 7
    Last Post: 03-13-2010, 05:09 PM
  4. [Tutorial]Using Hotkeys VB 08
    By Pixie in forum Visual Basic Programming
    Replies: 2
    Last Post: 10-25-2009, 01:04 PM
  5. [Tutorial] How To Mack HotKeys On VB
    By TheRedEye in forum WarRock - International Hacks
    Replies: 32
    Last Post: 06-23-2007, 10:24 PM