Use RegisterDeviceNotification() for ALL USB devices Use RegisterDeviceNotification() for ALL USB devices windows windows

Use RegisterDeviceNotification() for ALL USB devices


Used GUID_DEVINTERFACE_USB_DEVICE (in "usbiodef.h") to watch for all USB devices.

  DEV_BROADCAST_DEVICEINTERFACE NotificationFilter;  ZeroMemory(&NotificationFilter, sizeof(NotificationFilter));  NotificationFilter.dbcc_size = sizeof(NotificationFilter);  NotificationFilter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;  NotificationFilter.dbcc_reserved = 0;  NotificationFilter.dbcc_classguid = GUID_DEVINTERFACE_USB_DEVICE;  HDEVNOTIFY hDevNotify = RegisterDeviceNotification(hwnd, &NotificationFilter, DEVICE_NOTIFY_SERVICE_HANDLE);


Have you tried GUID_DEVCLASS_USB? (defined in devguid.h, Windows SDK)

Did you mean the DEVICE_NOTIFY_ALL_INTERFACE_CLASSES flag?

Also, I found the following article helpful - it's about device GUIDs vs interface GUIDs:

https://web.archive.org/web/20081227101643/http://blogs.msdn.com/doronh/archive/2006/02/15/532679.aspx