internal bool RegisterForPnPEvents(IntPtr hWnd) { if (_alreadyDisposed) { throw new ObjectDisposedException(""); } DEV_BROADCAST_HANDLE hFilter = new DEV_BROADCAST_HANDLE(); hFilter.dbch_size = Marshal.SizeOf(hFilter); hFilter.dbch_devicetype = CyConst.DBT_DEVTYP_HANDLE; hFilter.dbch_handle = _hDevice; _hHndNotification = PInvoke.RegisterDeviceNotification(hWnd, hFilter, CyConst.DEVICE_NOTIFY_WINDOW_HANDLE); if (_hHndNotification == IntPtr.Zero) { return(false); } return(true); }
internal static extern IntPtr RegisterDeviceNotification( [In] IntPtr h, [In] DEV_BROADCAST_HANDLE dFilter, [In] uint flags);
internal bool RegisterForPnPEvents(IntPtr hWnd) { if (_alreadyDisposed) throw new ObjectDisposedException(""); DEV_BROADCAST_HANDLE hFilter = new DEV_BROADCAST_HANDLE(); hFilter.dbch_size = Marshal.SizeOf(hFilter); hFilter.dbch_devicetype = CyConst.DBT_DEVTYP_HANDLE; hFilter.dbch_handle = _hDevice; _hHndNotification = PInvoke.RegisterDeviceNotification(hWnd, hFilter, CyConst.DEVICE_NOTIFY_WINDOW_HANDLE); if (_hHndNotification == IntPtr.Zero) return false; return true; }