Differentiating between data card and pen drive or USB flash drive

空扰寡人 提交于 2019-12-02 01:30:30

问题


I am having a Vodaphone data card which can be inserted in a USB port.

I have XP and Vista OS, and I am using WM_DEVICECHANGE event of Windows, to know USB Insertion and removal, and it's working fine for me.

But I am not able to differentiate between Data card insertion and Pen drive insertion. Is it possible?


回答1:


Yes. The "pen drive" and "data card" implement different interfaces. You will have subscribed using RegisterDeviceNotification for DEV_BROADCAST_DEVICEINTERFACE. The LPARAM of the WM_DEVICECHANGE you get back will then be a DEV_BROADCAST_DEVICEINTERFACE*. This structure has a dbcc_classguid member. This will be GUID_DEVINTERFACE_VOLUME for your pen drive, and something else for your datacard - experiment.



来源:https://stackoverflow.com/questions/1077968/differentiating-between-data-card-and-pen-drive-or-usb-flash-drive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!