Regarding the Windows platform, is their an event I can look for to tell when a USB drive or any type of portable media us plugged in?
+5
A:
You won't get such notifications without first registering for them. Use RegisterDeviceNotification() to do that.
After you have registered your window to receive such notifications, handle the WM_DEVICECHANGE message.
Stefan
2009-05-31 05:52:20
Is this the only way?
2009-05-31 05:54:50
the only way I know of.
Stefan
2009-05-31 06:34:44
-1, doesn't work because it's not needed. QUoting the linked MSDN article: "Volume notifications are broadcast to top-level windows, so the function fails if dbch_devicetype is DBT_DEVTYP_VOLUME". USB drives (implementing Mass Storage profile) are volumes.
MSalters
2009-07-02 15:54:05
+1
A:
Even though this article is about Qt, the code in the answer is relevant here.
sean e
2009-05-31 15:45:54