コード例 #1
0
ファイル: RawMouse.cs プロジェクト: oe3ide/OpenHPSDR-Thetis
        //static bool m_bPreviouslyRegistered = false;
        public RawMouse(IntPtr hwnd, bool captureOnlyInForeground)
        {
            var rid = new RawInputDevice[1];

            //if (m_bPreviouslyRegistered)
            //{
            //    rid[0].UsagePage = HidUsagePage.GENERIC;
            //    rid[0].Usage = HidUsage.Mouse;
            //    rid[0].Flags |= RawInputDeviceFlags.REMOVE;
            //    rid[0].Target = IntPtr.Zero;

            //    if (!Win32.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
            //    {
            //        throw new ApplicationException("Failed to unregister raw input device(s).");
            //    }
            //    m_bPreviouslyRegistered = false;
            //}

            rid[0].UsagePage = HidUsagePage.GENERIC;
            rid[0].Usage     = HidUsage.Mouse;
            rid[0].Flags     = (captureOnlyInForeground ? RawInputDeviceFlags.NONE : RawInputDeviceFlags.INPUTSINK) | RawInputDeviceFlags.DEVNOTIFY;
            rid[0].Target    = hwnd;

            if (!Win32.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
            {
                throw new ApplicationException("Failed to register raw mouse input device(s).");
            }
            else /*m_bPreviouslyRegistered = true;*/ } {
コード例 #2
0
ファイル: RawKeyboard.cs プロジェクト: vvvaga/USB4ScanGun
        public RawKeyboard(IntPtr hwnd)
        {
            var rid = new RawInputDevice[1];

            rid[0].UsagePage = HidUsagePage.GENERIC;
            rid[0].Usage     = HidUsage.Keyboard;
            rid[0].Flags     = RawInputDeviceFlags.INPUTSINK;
            rid[0].Target    = hwnd;

            if (!Win32.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
            {
                throw new ApplicationException("Failed to register raw input device(s).");
            }
        }
コード例 #3
0
ファイル: RawKeyboard.cs プロジェクト: uus169/USB4ScanGun
		public RawKeyboard(IntPtr hwnd)
		{
			var rid = new RawInputDevice[1];

			rid[0].UsagePage = HidUsagePage.GENERIC;       
			rid[0].Usage = HidUsage.Keyboard;              
			rid[0].Flags = RawInputDeviceFlags.INPUTSINK;
			rid[0].Target = hwnd;

			if(!Win32.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
			{
				throw new ApplicationException("Failed to register raw input device(s).");
			}
		}
コード例 #4
0
        public RawMouse(IntPtr hwnd, bool captureOnlyInForeground)
        {
            var rid = new RawInputDevice[1];

            rid[0].UsagePage = HidUsagePage.GENERIC;
            rid[0].Usage     = HidUsage.Mouse;
            rid[0].Flags     = (captureOnlyInForeground ? RawInputDeviceFlags.NONE : RawInputDeviceFlags.INPUTSINK) | RawInputDeviceFlags.DEVNOTIFY;
            rid[0].Target    = hwnd;

            if (!Win32.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
            {
                throw new ApplicationException("Failed to register raw input device(s).");
            }
        }
コード例 #5
0
		public RawKeyboard(IntPtr hwnd, bool captureOnlyInForeground)
		{
            //initTouch();
			var rid = new RawInputDevice[1];

			rid[0].UsagePage = HidUsagePage.GENERIC;
			rid[0].Usage = HidUsage.Keyboard;
            rid[0].Flags = (captureOnlyInForeground ? RawInputDeviceFlags.NONE : RawInputDeviceFlags.INPUTSINK) | RawInputDeviceFlags.DEVNOTIFY;
			rid[0].Target = hwnd;

			if(!Win32.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
			{
				throw new ApplicationException("Failed to register raw input device(s).");
			}
		}
コード例 #6
0
        public RawTouch(IntPtr hwnd, bool captureOnlyInForeground)
        {
            var rid = new RawInputDevice[1];

            rid[0].UsagePage = HidUsagePage.Digitizer; //this.touchDevice.DeviceInfo.UsagePage;
            rid[0].Usage     = HidUsage.Joystick;
            rid[0].Flags     = (captureOnlyInForeground ? RawInputDeviceFlags.NONE : RawInputDeviceFlags.INPUTSINK) | RawInputDeviceFlags.DEVNOTIFY;
            rid[0].Target    = hwnd;

            SetupStructSizes();

            if (!Win32.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
            {
                throw new ApplicationException("Failed to register raw input device(s).");
            }
        }
コード例 #7
0
ファイル: RawTouch.cs プロジェクト: tariqayad/rawinput-latest
        public RawTouch(IntPtr hwnd, bool captureOnlyInForeground)
        {

            var rid = new RawInputDevice[1];

            rid[0].UsagePage = HidUsagePage.Digitizer; //this.touchDevice.DeviceInfo.UsagePage;
            rid[0].Usage = HidUsage.Joystick;
            rid[0].Flags = (captureOnlyInForeground ? RawInputDeviceFlags.NONE : RawInputDeviceFlags.INPUTSINK) | RawInputDeviceFlags.DEVNOTIFY;
            rid[0].Target = hwnd;

            SetupStructSizes();

            if (!Win32.RegisterRawInputDevices(rid, (uint)rid.Length, (uint)Marshal.SizeOf(rid[0])))
            {
                throw new ApplicationException("Failed to register raw input device(s).");
            }
        }
コード例 #8
0
ファイル: Win32.cs プロジェクト: tariqayad/rawinput-latest
 internal static extern bool RegisterRawInputDevices(RawInputDevice[] pRawInputDevice, uint numberDevices, uint size);