How to get a signal when a USB device is added or removed
-
Is there any way to get a signal from the PC to my application when a USB device is added or removed from the PC. I have a USB chip (CP2102 from Silicon Laboratories), and I am currently polling every second and looking to see if it is still in the registry or not. There must be any easier way to detect a USB connection or disconnection in C or C++. Is there anyway to ask Windows to send me a message or an event?
-
Is there any way to get a signal from the PC to my application when a USB device is added or removed from the PC. I have a USB chip (CP2102 from Silicon Laboratories), and I am currently polling every second and looking to see if it is still in the registry or not. There must be any easier way to detect a USB connection or disconnection in C or C++. Is there anyway to ask Windows to send me a message or an event?
-
1 - RegisterDeviceNotification 2 - you can register a notification callback on changes to registry keys earl
Thank you for pointing me in the right direction. I will try that tonight.