示例#1
0
        ///<summary>
        ///KeyboardHookedイベントを発生させる。
        ///</summary>
        ///<param name="e">イベントのデータ。</param>
        protected virtual void OnKeyboardHooked(KeyboardHookedEventArgs e)
        {
            KeyboardHookedEventHandler handler = base.Events[EventKeyboardHooked] as KeyboardHookedEventHandler;

            if (handler != null)
            {
                handler(this, e);
            }
        }
示例#2
0
 private int CallNextHook(int code, KeyboardMessage message, ref KeyboardState state)
 {
     if (code >= 0)
     {
         KeyboardHookedEventArgs e = new KeyboardHookedEventArgs(message, ref state);
         OnKeyboardHooked(e);
         if (e.Cancel)
         {
             return(-1);
         }
     }
     return(CallNextHookEx(IntPtr.Zero, code, message, ref state));
 }
示例#3
0
        // Do forcibly Activate
        private void keyboardHook_KeyboardHooked(object sender, KeyboardHookedEventArgs e)
        {
            if ((ModifierKeys & Keys.Control) != Keys.Control)
            {
                return;
            }
            if (e.KeyCode != Keys.Q)
            {
                return;
            }

            WindowState = FormWindowState.Normal;
            SetForceFocus.PostMessage(new HandleRef(this, Handle), 0x400 + 1, (IntPtr)0, (IntPtr)0);
        }