- Home
·
- Miscellaneous
·
- Systemwide Hotkey, more than only activate the own app. The Message WM_HOTKEY is sent to the form s
Systemwide Hotkey, more than only activate the own app. The Message WM_HOTKEY is sent to the form s
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
Rate Systemwide Hotkey, more than only activate the own app. The Message WM_HOTKEY is sent to the form s
(1(1 Vote))
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
Systemwide Hotkey, more than only activate the own app. The Message WM_HOTKEY is sent to the form s Comments
No comments yet — be the first to post one!
Post a Comment