Beispiel #1
0
        private static unsafe IntPtr RegisterForDeviceNotifications(WinWindowInfo parent)
        {
            BroadcastDeviceInterface type = new BroadcastDeviceInterface();

            type.Size       = BlittableValueType.StrideOf <BroadcastDeviceInterface>(type);
            type.DeviceType = DeviceBroadcastType.INTERFACE;
            type.ClassGuid  = WinRawInput.DeviceInterfaceHid;
            IntPtr num1 = Functions.RegisterDeviceNotification(parent.WindowHandle, new IntPtr((void *)&type), DeviceNotification.WINDOW_HANDLE);
            int    num2 = num1 == IntPtr.Zero ? 1 : 0;

            return(num1);
        }
        static IntPtr RegisterForDeviceNotifications(WinWindowInfo parent)
        {
            IntPtr dev_notify_handle;
            BroadcastDeviceInterface bdi = new BroadcastDeviceInterface();
            bdi.Size = BlittableValueType.StrideOf(bdi);
            bdi.DeviceType = DeviceBroadcastType.INTERFACE;
            bdi.ClassGuid = DeviceInterfaceHid;
            unsafe
            {
                dev_notify_handle = Functions.RegisterDeviceNotification(parent.WindowHandle,
                    new IntPtr((void*)&bdi), DeviceNotification.WINDOW_HANDLE);
            }
            if (dev_notify_handle == IntPtr.Zero)
                Debug.Print("[Warning] Failed to register for device notifications. Error: {0}", Marshal.GetLastWin32Error());

            return dev_notify_handle;
        }
Beispiel #3
0
        static IntPtr RegisterForDeviceNotifications(WinWindowInfo parent)
        {
            IntPtr dev_notify_handle;
            BroadcastDeviceInterface bdi = new BroadcastDeviceInterface();

            bdi.Size       = BlittableValueType.StrideOf(bdi);
            bdi.DeviceType = DeviceBroadcastType.INTERFACE;
            bdi.ClassGuid  = DeviceInterfaceHid;
            unsafe
            {
                dev_notify_handle = Functions.RegisterDeviceNotification(parent.WindowHandle,
                                                                         new IntPtr((void *)&bdi), DeviceNotification.WINDOW_HANDLE);
            }
            if (dev_notify_handle == IntPtr.Zero)
            {
                Debug.Print("[Warning] Failed to register for device notifications. Error: {0}", Marshal.GetLastWin32Error());
            }

            return(dev_notify_handle);
        }
Beispiel #4
0
        private static IntPtr RegisterForDeviceNotifications(WinWindowInfo parent)
        {
            IntPtr dev_notify_handle;
            var    bdi = new BroadcastDeviceInterface
            {
                Size       = BroadcastDeviceInterface.SizeInBytes,
                DeviceType = DeviceBroadcastType.DeviceInterface,
                ClassGuid  = DeviceInterfaceHid
            };

            unsafe
            {
                dev_notify_handle = User32.Device.RegisterDeviceNotification(parent.Handle,
                                                                             new IntPtr(&bdi), DeviceNotificationEnum.WindowHandle);
            }

            if (dev_notify_handle == IntPtr.Zero)
            {
                Debug.Print("[Warning] Failed to register for device notifications. Error: {0}",
                            Marshal.GetLastWin32Error());
            }

            return(dev_notify_handle);
        }
Beispiel #5
0
 private static unsafe IntPtr RegisterForDeviceNotifications(WinWindowInfo parent)
 {
     BroadcastDeviceInterface type = new BroadcastDeviceInterface();
       type.Size = BlittableValueType.StrideOf<BroadcastDeviceInterface>(type);
       type.DeviceType = DeviceBroadcastType.INTERFACE;
       type.ClassGuid = WinRawInput.DeviceInterfaceHid;
       IntPtr num1 = Functions.RegisterDeviceNotification(parent.WindowHandle, new IntPtr((void*) &type), DeviceNotification.WINDOW_HANDLE);
       int num2 = num1 == IntPtr.Zero ? 1 : 0;
       return num1;
 }