public DeviceEventNotifier(IntPtr windowHandle, Guid deviceClass) { base.AssignHandle(windowHandle); var filterInterface = new User32.BroadcastDeviceInterface { DeviceClass = deviceClass }; var filter = new User32.BroadcastHdr { Size = Marshal.SizeOf(typeof (User32.BroadcastHdr)), DeviceType = User32.DeviceType.Interface, Interface = filterInterface }; notificationHandle = User32.RegisterDeviceNotification(base.Handle, filter, User32.DeviceNotificationFlags.WindowHandle); }
public DeviceEventNotifier(IntPtr windowHandle, Guid deviceClass) { base.AssignHandle(windowHandle); var filterInterface = new User32.BroadcastDeviceInterface { DeviceClass = deviceClass }; var filter = new User32.BroadcastHdr { Size = Marshal.SizeOf(typeof(User32.BroadcastHdr)), DeviceType = User32.DeviceType.Interface, Interface = filterInterface }; notificationHandle = User32.RegisterDeviceNotification(base.Handle, filter, User32.DeviceNotificationFlags.WindowHandle); }