Ejemplo n.º 1
0
 private void keyboardHook1_KeyboardHooked(object sender, HongliangSoft.Utilities.Gui.KeyboardHookedEventArgs e)
 {
     if (e.UpDown == KeyboardUpDown.Down)
     {
         textBox1.Text = e.KeyCode.ToString();
     }
 }
Ejemplo n.º 2
0
        private void keyboardHook1_KeyboardHooked(object sender, HongliangSoft.Utilities.Gui.KeyboardHookedEventArgs e)
        {
            if (e.UpDown == KeyboardUpDown.Down)
            {
                //Console.WriteLine(e.KeyCode.ToString());
                if (e.KeyCode == Keys.F12)
                {
                    this.TopMost = true;
                    this.TopMost = false;
                    this.Activate();
                    this.WindowState = FormWindowState.Maximized;
                    Console.WriteLine("wei");
                }
                switch (e.KeyCode)
                {
                case Keys.F1:
                    menunum = 1;
                    ctr1.Changerabbit(menunum);
                    break;

                case Keys.F2:
                    menunum = 2;
                    ctr1.Changerabbit(menunum);
                    break;

                case Keys.F3:
                    menunum = 3;
                    ctr1.Changerabbit(menunum);
                    break;

                case Keys.F4:
                    menunum = 4;
                    ctr1.Changerabbit(menunum);
                    break;

                case Keys.F5:
                    menunum = 5;
                    ctr1.Changerabbit(menunum);
                    break;

                case Keys.F6:
                    menunum = 6;
                    ctr1.Changerabbit(menunum);
                    break;

                case Keys.F7:
                    menunum = 7;
                    ctr1.Changerabbit(menunum);
                    break;

                case Keys.F8:
                    menunum = 8;
                    ctr1.Changerabbit(menunum);
                    break;
                }
                //Console.WriteLine(menunum);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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));
 }
Ejemplo n.º 5
0
 private int CallNextHook(int code, KeyboardMessage message, ref KeyboardState state)
 {
     if (code >= 0)
     {
         state.KeyCode = KeyInterop.KeyFromVirtualKey((int)state.KeyCode);
         KeyboardHookedEventArgs e = new KeyboardHookedEventArgs(message, ref state);
         OnKeyboardHooked(e);
         if (e.Cancel)
         {
             return(-1);
         }
     }
     return(CallNextHookEx(IntPtr.Zero, code, message, ref state));
 }
Ejemplo n.º 6
0
        private void keyboardHook1_KeyboardHooked(object sender, HongliangSoft.Utilities.Gui.KeyboardHookedEventArgs e)
        {
            try
            {
                Debug.Print(e.KeyCode.ToString("d"));
                if (_state != state.none)
                {
                    return;
                }

                if (e.UpDown == KeyboardUpDown.Down)
                {
                    //Debug.Print("keydown"+ e.KeyCode.ToString("d"));
                    _keyManager.addKeyDown(int.Parse(e.KeyCode.ToString("d")));
                }
                if (e.UpDown == KeyboardUpDown.Up)
                {
                    //Debug.Print("keyup" + e.KeyCode.ToString("d"));
                    _keyManager.removeKeyUp(int.Parse(e.KeyCode.ToString("d")));
                }

                //if( _keyManager.searchKeyCode((int)Keys.B))

                //クリップボードにキャプチャ
                if (_keyManager.searchKeyCode(_pressTarget_clip))
                {
                    _state = state.keyPress;
                    _mode  = mode.clip;
                    _keyManager.ClearKeyList();
                    //仮想スクリーンを展開する
                    ShowVirtualScreen();
                }

                //フォルダにキャプチャイメージを保存
                else if (_keyManager.searchKeyCode(_pressTarget_save))
                {
                    _state = state.keyPress;
                    _mode  = mode.save;
                    _keyManager.ClearKeyList();
                    //仮想スクリーンを展開する
                    ShowVirtualScreen();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// globalHookを実現する自作イベントハンドラ
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CallMainWindow(object sender, HongliangSoft.Utilities.Gui.KeyboardHookedEventArgs e)
        {
            if (e.UpDown != KeyboardUpDown.Down)
            {
                if (e.AltDown && e.KeyCode == System.Windows.Forms.Keys.Q)
                {
                    if (!this.IsVisible)
                    {
                        this.Show();
                    }

                    if (this.WindowState == WindowState.Minimized)
                    {
                        this.WindowState = WindowState.Normal;
                    }
                    this.Activate();
                    this.Topmost = true;                      // important
                    this.Topmost = false;                     // important
                    this.Focus();                             // important
                }
            }
        }
 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);
 }
 ///<summary>
 ///KeyboardHooked�C�x���g�𔭐�������B
 ///</summary>
 ///<param name="e">�C�x���g�̃f�[�^�B</param>
 protected virtual void OnKeyboardHooked(KeyboardHookedEventArgs e)
 {
     KeyboardHookedEventHandler handler = base.Events[EventKeyboardHooked] as KeyboardHookedEventHandler;
     if (handler != null)
         handler(this, e);
 }
Ejemplo n.º 10
0
        ///<summary>
        ///KeyboardHookedイベントを発生させる。
        ///</summary>
        ///<param name="e">イベントのデータ。</param>
        protected virtual void OnKeyboardHooked(KeyboardHookedEventArgs e)
        {
            var handler = base.Events[EventKeyboardHooked] as KeyboardHookedEventHandler;

            handler?.Invoke(this, e);
        }