[Source] Easy global hotkeys for VB.net

Discussion in 'Programming General' started by Blupig, Nov 19, 2011.

[Source] Easy global hotkeys for VB.net
  1. Unread #1 - Nov 19, 2011 at 4:22 PM
  2. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    [Source] Easy global hotkeys for VB.net

    Code:
    Private Declare Function GetKeyPress Lib "user32" Alias "GetAsyncKeyState" (ByVal key As Integer) As Integer
    
        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
            If GetKeyPress(Keys.Enter) Then
                MsgBox("Enter was pressed yo")
            End If
        End Sub
    
    I can't believe I didn't think of doing this before, I've been using overrides this whole time for hotkeys D:

    If you want to use complex hotkeys, then change the if statement:
    Code:
            If GetKeyPress(Keys.Control) & GetKeyPress(Keys.Alt) & GetKeyPress(Keys.A) Then
                MsgBox("F5")
            End If
    (That's for Ctrl+Alt+A)
     
  3. Unread #2 - Nov 20, 2011 at 8:51 PM
  4. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    [Source] Easy global hotkeys for VB.net

    Right on. Good job blupig.
     
  5. Unread #3 - Nov 22, 2011 at 2:20 AM
  6. Covey
    Joined:
    Sep 9, 2005
    Posts:
    4,510
    Referrals:
    9
    Sythe Gold:
    9
    Discord Unique ID:
    807246764155338833
    Discord Username:
    Covey#1816

    Covey Creator of EliteSwitch
    Retired Sectional Moderator Visual Basic Programmers

    [Source] Easy global hotkeys for VB.net

    Isn't there a createhotkey api?
    either way this way is quicker :p
     
  7. Unread #4 - Jan 20, 2012 at 8:28 PM
  8. jasonfish4
    Joined:
    Jan 20, 2012
    Posts:
    30
    Referrals:
    1
    Sythe Gold:
    0

    jasonfish4 Member

    [Source] Easy global hotkeys for VB.net

    Wow great job! :)
     
< C program help | Noob question >

Users viewing this thread
1 guest


 
 
Adblock breaks this site