Results 1 to 6 of 6

Thread: [2005] Register Multiple Global Hotkeys (E.G Ctrl + G + E)

Threaded View

  1. #1

    Thread Starter
    Frenzied Member Icyculyr's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    1,934

    [2005] Register Multiple Global Hotkeys (E.G Ctrl + G + E)

    I am having two problems:
    Problem 1: I am unable to register a series of key combinations, such as Ctrl + Shift + E + K, I can only register E or K...
    Problem 2: when I put Keys.Control, or Keys.Shift in the second last parameter of RegisterHotKey (which is the fsModifiers parameter) the hotkey doesn't work... even if I put in the last parameter as Keys.Control where normally Keys.E would go, it doesn't launch when I press control...
    Does anyone know why?

    The code I am using:

    vb.net Code:
    1. Public Class Form1    
    2.       Public Declare Function RegisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer, ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer    
    3.       Public Declare Function UnregisterHotKey Lib "user32" (ByVal hwnd As IntPtr, ByVal id As Integer) As Integer    
    4.       Public Const WM_HOTKEY As Integer = &H312    
    5.       Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)                  
    6.       If m.Msg = WM_HOTKEY Then        ' Pressed the hotkey
    7.          Debug.WriteLine(m.Msg.ToString & ":" & m.WParam.ToString & ":" & m.LParam.ToString)      
    8.       End If
    9.       MyBase.WndProc(m)
    10.       End Sub    
    11.       Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles e.FormClosing
    12.            Call UnregisterHotKey(Me.Handle.toint32, 0)
    13.       End Sub    
    14.       Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    15.            Call RegisterHotKey(Me.Handle.toint32, 0, 0, 27)
    16.       End Sub
    17.       End Class

    Thanks
    Last edited by Icyculyr; Jan 28th, 2008 at 02:05 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width