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: