views:

216

answers:

1

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?

+2  A: 

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.

MSalters