I can create and use system-wide hotkeys by using RegisterHotkey and UnregisterHotkey(), as follows:
Enum HotkeyModifier As UShort
None = &H0
Alt = &H1 'Alt key
Control = &H2
Shift = &H4
Windows = &H8
WM_HOTKEY = &H312
Norepeat = &H4000
End Enum
'
<Runtime.InteropServices.DllImport("User32.dll")> _
Public Shared Function RegisterHotKey(ByVal hwnd As IntPtr, ByVal id As Integer, _
ByVal fsModifiers As Integer, ByVal vk As Integer) As Integer
End Function
<Runtime.InteropServices.DllImport("User32.dll")> _
Public Shared Function UnregisterHotKey(ByVal hwnd As IntPtr, ByVal id As Integer) As Integer
End Function
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = HotkeyModifier.WM_HOTKEY Then
Dim id As IntPtr = m.WParam
Select Case (id.ToInt32)
Case 100
MessageBox.Show("You pressed ALT+D key combination")
Case 300
MessageBox.Show("You pressed CTRL+SHIFT+F12 key combination")
Case 399
SwitchTopMost()
End Select
End If
MyBase.WndProc(m)
End Sub
Friend Sub SwitchTopMost()
Me.TopMost = Not Me.TopMost
If Me.TopMost Then
Me.Show()
Me.ClientSize = New Size(Me.RestoreBounds.X, Me.RestoreBounds.Y)
Me.ClientSize = RestoreSize
Else : Me.Hide()
End If
End Sub
Private Sub Unregister(ByVal sender As System.Object, ByVal e As _
System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
UnregisterHotKey(Me.Handle, 100)
UnregisterHotKey(Me.Handle, 300)
UnregisterHotKey(Me.Handle, 399)
End Sub
Private Sub Register(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
RegisterHotKey(Me.Handle, 100, HotkeyModifier.Alt, Keys.D)
RegisterHotKey(Me.Handle, 300, HotkeyModifier.Control + HotkeyModifier.Shift, Keys.F12)
RegisterHotKey(Me.Handle, 399, HotkeyModifier.Alt, Keys.None)
End Sub
But is there anything that can create more customizable system-wide hotkeys like Space+S, NumLock+Control+P or Tab+CapsLock+F5? I am running out of hotkeys.
More info about these hotkeys: Another post about hotkeys
Also would like something like this post without other programs.
Edit: I would prefer a way like the above link the most.