예제 #1
0
        /// <summary>
        /// Initializes hooks
        /// </summary>
        private void SetUpHooks()
        {
            if (RibbonDesigner.Current == null)
             {
            if (_mouseHook == null)
            {
               _mouseHook = new GlobalHook(GlobalHook.HookTypes.Mouse);
               _mouseHook.MouseWheel += new MouseEventHandler(_mouseHook_MouseWheel);
               _mouseHook.MouseDown += new MouseEventHandler(_mouseHook_MouseDown);
            }

            if (_keyboardHook == null)
            {
               _keyboardHook = new GlobalHook(GlobalHook.HookTypes.Keyboard);
               _keyboardHook.KeyDown += new KeyEventHandler(_keyboardHook_KeyDown);
            }
             }
        }
예제 #2
0
        /// <summary>
        /// Initializes hooks
        /// </summary>
        private void SetUpHooks()
        {
            if (!(Site != null && Site.DesignMode))
             {
             //   _mouseHook = new GlobalHook(GlobalHook.HookTypes.Mouse);
            //    _mouseHook.MouseWheel += new MouseEventHandler(_mouseHook_MouseWheel);
            //    _mouseHook.MouseDown += new MouseEventHandler(_mouseHook_MouseDown);

            _keyboardHook = new GlobalHook(GlobalHook.HookTypes.Keyboard);
            _keyboardHook.KeyDown += new KeyEventHandler(_keyboardHook_KeyDown);
             }
        }
예제 #3
0
 private void DisposeHooks()
 {
     if (_mouseHook != null)
      {
     _mouseHook.MouseWheel -= new MouseEventHandler(_mouseHook_MouseWheel);
     _mouseHook.MouseDown -= new MouseEventHandler(_mouseHook_MouseDown);
     _mouseHook.Dispose();
     _mouseHook = null;
      }
      if (_keyboardHook != null)
      {
     _keyboardHook.KeyDown -= new KeyEventHandler(_keyboardHook_KeyDown);
     _keyboardHook.Dispose();
     _keyboardHook = null;
      }
 }
예제 #4
0
 internal static extern int SetWindowsHookEx(int idHook, GlobalHook.HookProcCallBack lpfn, IntPtr hInstance, int threadId);