bool RegisterForPnpEvents(IntPtr h) { PInvoke.HidD_GetHidGuid(ref HidGuid); DEV_BROADCAST_DEVICEINTERFACE dFilter = new DEV_BROADCAST_DEVICEINTERFACE(); dFilter.dbcc_size = Marshal.SizeOf(dFilter); dFilter.dbcc_devicetype = gc.DBT_DEVTYP_DEVICEINTERFACE; dFilter.dbcc_classguid = HidGuid; hDevNotification = PInvoke.RegisterDeviceNotification(h, dFilter, gc.DEVICE_NOTIFY_WINDOW_HANDLE); if (hDevNotification == IntPtr.Zero) { return(false); } return(true); }
bool RegisterForPnpEvents(IntPtr h, Guid DrvGuid) { DEV_BROADCAST_DEVICEINTERFACE dFilter = new DEV_BROADCAST_DEVICEINTERFACE(); dFilter.dbcc_size = Marshal.SizeOf(dFilter); dFilter.dbcc_devicetype = CyConst.DBT_DEVTYP_DEVICEINTERFACE; dFilter.dbcc_classguid = DrvGuid; IntPtr hNotify = PInvoke.RegisterDeviceNotification(h, dFilter, CyConst.DEVICE_NOTIFY_WINDOW_HANDLE); if (hNotify == IntPtr.Zero) { return(false); } hDevNotifications.Add(hNotify); return(true); }
bool RegisterForPnpEvents(IntPtr h) { PInvoke.HidD_GetHidGuid(ref HidGuid); DEV_BROADCAST_DEVICEINTERFACE dFilter = new DEV_BROADCAST_DEVICEINTERFACE(); dFilter.dbcc_size = Marshal.SizeOf(dFilter); dFilter.dbcc_devicetype = gc.DBT_DEVTYP_DEVICEINTERFACE; dFilter.dbcc_classguid = HidGuid; hDevNotification = PInvoke.RegisterDeviceNotification(h, dFilter, gc.DEVICE_NOTIFY_WINDOW_HANDLE); if (hDevNotification == IntPtr.Zero) return false; return true; }
internal static extern IntPtr RegisterDeviceNotification( [In] IntPtr h, [In] DEV_BROADCAST_DEVICEINTERFACE dFilter, [In] uint flags);
bool RegisterForPnpEvents(IntPtr h, Guid DrvGuid) { DEV_BROADCAST_DEVICEINTERFACE dFilter = new DEV_BROADCAST_DEVICEINTERFACE(); dFilter.dbcc_size = Marshal.SizeOf(dFilter); dFilter.dbcc_devicetype = CyConst.DBT_DEVTYP_DEVICEINTERFACE; dFilter.dbcc_classguid = DrvGuid; IntPtr hNotify = PInvoke.RegisterDeviceNotification(h, dFilter, CyConst.DEVICE_NOTIFY_WINDOW_HANDLE); if (hNotify == IntPtr.Zero) return false; hDevNotifications.Add(hNotify); return true; }