Пример #1
0
        /// <summary>
        /// Thread message event handler.
        /// </summary>
        /// <param name="msg">The MSG.</param>
        /// <param name="handled">if set to <c>true</c> [handled].</param>
        private void ThreadMessageEventHandler(ref MSG msg, ref bool handled)
        {
            if (handled || msg.message != WM_HOTKEY)
            {
                return;
            }
            int         id         = (int)msg.wParam;
            VirtualKeys virtualKey = (VirtualKeys)(((int)msg.lParam >> 16) & 0xFFFF);
            Modifiers   modifiers  = (Modifiers)((int)msg.lParam & 0xFFFF);

            KeyModifierCombination keyModifierCombination = new KeyModifierCombination(virtualKey, modifiers);

            if (HotKeys.ContainsKey(keyModifierCombination))
            {
                HotKeyPressedEventArgs args = new HotKeyPressedEventArgs(msg.pt_x, msg.pt_y, msg.time, id, virtualKey, modifiers);
                HotKeys[keyModifierCombination].HotKeyPressed(args);
            }
        }
Пример #2
0
 /// <summary>
 /// Called when the associated hot key is pressed. Do not call this method manually. Use <see cref="HotKeyManager"/>
 /// </summary>
 public void HotKeyPressed(HotKeyPressedEventArgs args)
 {
     HotKeyPressedEvent?.Invoke(this, args);
 }