| Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Long) As Long 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 'put this code in the Form_Load event of a form 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 |
India web developer web development India | Freelance web development ecommerce web developer | Prayagasoft - web designer India, Ecommerce developer india, Ecommerce design