by Ascher Stefan (8 Submissions)
Category: Miscellaneous
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 28th March 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Systemwide Hotkey, more than only activate the own app. The Message WM_HOTKEY is sent to the form specified as ownerform, so you have to
API Declarations
(ByVal hWnd As Long, ByVal id As Long, _
ByVal fsModifiers As Long, ByVal vk As Long) As Long
Private Declare Function UnregisterHotKey Lib "user32" _
(ByVal hWnd As Long, ByVal id As Long) As Long
Public Enum ModConst
MOD_ALT = &H1 'Alt Key
MOD_CONTROL = &H2 'Ctrl Key
MOD_SHIFT = &H4 'Shift Key
End Enum
'Count of Hotkeys
Private m_hkCount As Integer
Modifier As ModConst, KeyCode As Integer) As Integer
'Modifier are the keys "Shift", "Alt" and "Ctrl"
'KeyCode is the same as the KeyCode in the KeyDow, -up Event
'If the install is successfully the WM_HOTKEY is sent to the window
'specidied in hWnd -> Windowhandle, so you have to subclass this
' wParam KotKey Identifier, the first installed Hotkey has the identifiere 1,
'the secon 2 and so on.
' lParam LoWord Modifier (Strg etc.)
' lParam HiWord KeyCode
m_hkCount = m_hkCount + 1
RegisterHotKey hWnd, m_hkCount, Modifier, KeyCode
HotKeyActivate = m_hkCount
End Function
Function HotKeyDeactivate(ByVal hWnd As Long)
'Uninstalls ALL activated Hotkeys
Dim i As Integer
For i = 1 To m_hkCount
UnregisterHotKey hWnd, i
Next i
m_hkCount = 0
End Function
No comments have been posted about Systemwide Hotkey, more than only activate the own app. The Message WM_HOTKEY is sent to the form s. Why not be the first to post a comment about Systemwide Hotkey, more than only activate the own app. The Message WM_HOTKEY is sent to the form s.