主要使用RegisterDeviceNotification这个sdk
DEV_BROADCAST_DEVICEINTERFACE Filter;
ZeroMemory(&Filter, sizeof(Filter));
Filter.dbcc_size = sizeof(Filter);
Filter.dbcc_devicetype = DBT_DEVTYP_DEVICEINTERFACE;
GUID WceusbshGUID = { 0x25dbce51, 0x6c8f, 0x4a72, 0x8a,0x6d,0xb5,0x4c,0x2b,0x4f,0xc8,0x35 };
Filter.dbcc_classguid = WceusbshGUID;
//DEVICE_NOTIFY_ALL_INTERFACE_CLASSES //关注所有设备事件
HDEVNOTIFY m_hDeviceNotify = RegisterDeviceNotification(this->m_hWnd, &Filter, 0x00000004);