Introduction - If you have any usage issues, please Google them yourself
When a USB device is inserted or pop-up, Windows will generate a global message: WM_DEVICECHANGE
We need to do is get this message wParam parameter, if it means that there is DBT_DEVICEARRIVAL device inserted and available,
If there is DBT_DEVICEREMOVECOMPLETE said equipment has been removed. Then view the lParam parameter is DBT_DEVTYP_VOLUME,
You can remove the volume number dbcv_unitmask DEV_BROADCAST_VOLUME structure, you know what the volume is inserted or ejected.