Detecting USB Insertion / Removal Events in Windows using C++
问题 I am writing an extension for an existing application that needs to handle USB insertion/removal events. I know the VID/PID of the device of interest. However, I don\'t have access to the window handle, so I don\'t know if RegisterDeviceNotification will be of much use, unless there is a way to obtain the handle via the WINAPI . What would be the best way to detect USB insertion/removal events with C++? This sample code on the Microsoft website shows how to receive event notifications via WMI