Exemplo n.º 1
0
        public void End()
        {
            Application.RemoveMessageFilter(messageFilter);

            var result = RawInput.RegisterDevice(UsagePage.HID_USAGE_PAGE_GENERIC, UsageId.HID_USAGE_GENERIC_MOUSE, ModeFlags.RIDEV_REMOVE, IntPtr.Zero);

            if (!result)
            {
                throw new Exception("Failed to unregister a mouse device for raw input");
            }
        }
Exemplo n.º 2
0
        public void Start()
        {
            var result = RawInput.RegisterDevice(UsagePage.HID_USAGE_PAGE_GENERIC, UsageId.HID_USAGE_GENERIC_MOUSE, ModeFlags.RIDEV_INPUTSINK, targetWindow);

            if (!result)
            {
                throw new Exception("Failed to register a mouse device for raw input");
            }

            Application.AddMessageFilter(messageFilter);
        }