VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Create a hotkey for your application

by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 4.0 (32-bit)
Difficulty: Unknown Difficulty
Originally Published: Wed 13th January 1999
Date Added: Mon 8th February 2021
Rating: (1 Votes)

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



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)

Download this snippet    Add to My Saved Code

Create a hotkey for your application Comments

No comments have been posted about Create a hotkey for your application. Why not be the first to post a comment about Create a hotkey for your application.

Post your comment

Subject:
Message:
0/1000 characters