Example #1
0
        private ButtonCode XButton(MOUSEHOOKSTRUCTEX Value)
        {
            var ret = ButtonCode.None;

            if (Value.MouseData.HiWord == 1)
            {
                ret = ButtonCode.XButton1;
            }
            else if (Value.MouseData.HiWord == 2)
            {
                ret = ButtonCode.XButton2;
            }

            return(ret);
        }
Example #2
0
        private static int HandleHookProc(int code, IntPtr wParam, IntPtr lParam)
        {
            if (code < 0)
            {
                return(Win32API.CallNextHookEx(hookPtr, code, wParam, lParam));
            }

            NativeMouseEvent  eventCode = unchecked ((NativeMouseEvent)wParam);
            MOUSEHOOKSTRUCTEX data      = MOUSEHOOKSTRUCTEX.CreateFromPtr(lParam);
            MousePosition     pos       = new MousePosition {
                x = data.pt.x, y = data.pt.y
            };
            int wheelDelta = unchecked ((short)((long)data.mouseData >> 16));

            if (HandleMouseEvent(eventCode, pos, wheelDelta) && InterceptMessages)
            {
                return(1);
            }
            else
            {
                return(Win32API.CallNextHookEx(hookPtr, 0, wParam, lParam));
            }
        }