Create a hotkey for your application
Create a hotkey for your application
API Declarations
Declare Function DefWindowProc Lib "user32" Alias "DefWindowProcA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const WM_SETHOTKEY = &H32
Public Const WM_SHOWWINDOW = &H18
Public Const HK_SHIFTA = &H141 'Shift + A
Public Const HK_SHIFTB = &H142 'Shift * B
Public Const HK_CONTROLA = &H241 'Control + A
Public Const HK_ALTZ = &H45A
Rate Create a hotkey for your application
(2(2 Vote))
Dim lngReturn As Long
'minimize window
Me.WindowState = vbMinimized
'select the hotkey for your app, ALT-Z in this case
lngReturn = SendMessage(Me.hwnd, WM_SETHOTKEY, HK_ALTZ, 0)
'Check if succesfull
If lngReturn <> 1 Then
MsgBox "Select another hotkey"
End If
'Tell windows what to do when hotkey is selected
lngReturn = DefWindowProc(Me.hwnd, WM_SHOWWINDOW, 0, 0)
Create a hotkey for your application Comments
No comments yet — be the first to post one!
Post a Comment