protected override void WndProc(ref Message m)
 {
     // Trap WM_DEVICECHANGE
     if (m.Msg == NativeMethods.WM_DEVICECHANGE)
     {
         DeviceNotify?.Invoke(HidDevices.EnumerateDevices().ToList());
     }
     base.WndProc(ref m);
 }
        protected override void WndProc(ref Message m)
        {
            // Trap WM_DEVICECHANGE
            if (m.Msg == 0x219)
            {
                DeviceNotify?.Invoke(m);
            }

            base.WndProc(ref m);
        }
Example #3
0
 private void ReportDeviceAttached(Message message)
 {
     DeviceAttached?.Invoke(this, null);
     DeviceNotify?.Invoke(this, new EventArgs <Message>(message));
 }
 public static extern IntPtr RegisterSuspendResumeNotification(
     [MarshalAs(UnmanagedType.LPStruct)] ref DeviceNotifySubscribeParameters hRecipient,
     [MarshalAs(UnmanagedType.U4)] DeviceNotify Flags
     );
 public static extern IntPtr RegisterSuspendResumeNotification(
     IntPtr hRecipient,
     [MarshalAs(UnmanagedType.U4)] DeviceNotify Flags
     );
 public static extern IntPtr RegisterPowerSettingNotification(
     IntPtr hRecipient,
     Guid PowerSettingGuid,
     [MarshalAs(UnmanagedType.U4)] DeviceNotify Flags
     );