Exemplo n.º 1
0
        private bool ProcessKeyboardEvent(BaseHook.KeyState keyState, uint key)
        {
            var windowtitle = Win32Utils.GetActiveWindowTitle();

            if (windowtitle != this.Title)
            {
                return(false);
            }
            CursorPoint mPoint = GetCurrentMousePosition();

            if (mPoint == null)
            {
                return(false);
            }

            if (this.isInterceptKey((Keys)key))
            {
                return(false);
            }

            KeyboardEvent kEvent = new KeyboardEvent
            {
                Key    = (Keys)key,
                Action = (keyState == BaseHook.KeyState.Keydown) ? Constants.KEY_DOWN : Constants.KEY_UP
            };

            //Console.WriteLine("添加键盘事件:" + JsonConvert.SerializeObject(kEvent));
            LogKeyboardEvents(kEvent);
            return(false);
        }
Exemplo n.º 2
0
        private bool ProcessMouseEvent(MouseHook.MouseEvents mAction, int mValue)
        {
            var windowtitle = Win32Utils.GetActiveWindowTitle();

            if (windowtitle != this.Title)
            {
                return(false);
            }

            CursorPoint mPoint = GetCurrentMousePosition();

            if (mPoint == null)
            {
                return(false);
            }
            MouseEvent mEvent = new MouseEvent
            {
                Location = mPoint,
                Action   = mAction,
                Value    = mValue
            };

            //Console.WriteLine("添加鼠标事件:" + JsonConvert.SerializeObject(mEvent));
            LogMouseEvents(mEvent);
            return(false);
        }