Ejemplo n.º 1
0
        private IntPtr MouseHookDelegate(Int32 code, IntPtr wParam, IntPtr lParam)
        {
            if (code < 0)
            {
                return(WindowsHookHelper.CallNextHookEx(mouseHandle, code, wParam, lParam));
            }

            MouseMoved?.Invoke(this, new EventArgs());

            return(WindowsHookHelper.CallNextHookEx(mouseHandle, code, wParam, lParam));
        }
Ejemplo n.º 2
0
        protected virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                if (mouseHandle != IntPtr.Zero)
                {
                    WindowsHookHelper.UnhookWindowsHookEx(mouseHandle);
                }

                _disposed = true;
            }
        }
Ejemplo n.º 3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposed)
            {
                if (keyBoardHandle != IntPtr.Zero)
                {
                    WindowsHookHelper.UnhookWindowsHookEx(
                        keyBoardHandle);
                }

                disposed = true;
            }
        }
Ejemplo n.º 4
0
        private IntPtr KeyboardHookDelegate(
            Int32 Code, IntPtr wParam, IntPtr lParam)
        {
            if (Code < 0)
            {
                return(WindowsHookHelper.CallNextHookEx(
                           keyBoardHandle, Code, wParam, lParam));
            }

            if (KeyBoardKeyPressed != null)
            {
                KeyBoardKeyPressed(this, new EventArgs());
            }

            return(WindowsHookHelper.CallNextHookEx(
                       keyBoardHandle, Code, wParam, lParam));
        }
Ejemplo n.º 5
0
 public MouseInput()
 {
     mouseDelegate = MouseHookDelegate;
     mouseHandle   = WindowsHookHelper.SetWindowsHookEx(WH_MOUSE_LL, mouseDelegate, IntPtr.Zero, 0);
 }
Ejemplo n.º 6
0
 public KeyboardInput()
 {
     keyBoardDelegate = KeyboardHookDelegate;
     keyBoardHandle   = WindowsHookHelper.SetWindowsHookEx(
         WH_KEYBOARD_LL, keyBoardDelegate, IntPtr.Zero, 0);
 }