Need help retrieving the drive letter uppon mass storage arrival
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9

Thread: Need help retrieving the drive letter uppon mass storage arrival

Threaded View

  1. #1
    Join Date
    Apr 2008
    Posts
    6

    Post Need help retrieving the drive letter upon mass storage arrival

    Hi,

    I'm writing a simple software that has to detect a new USB device insertion and basically retrieve a couple of informations from it before it really start working.

    By using some MSDN references I could get the message for device arrival without major problems, however, I'm not being able to get the drive letter.

    basically this is what I did:

    1- Registered my software to receive device arrival/removal message for the desired type:

    static const GUID GUID_DEVINTERFACE_USBSTOR =
    { 0xA5DCBF10L, 0x6530, 0x11D2, { 0x90, 0x1F, 0x00, 0xC0, 0x4F, 0xB9, 0x51, 0xED } };
    ....
    hDevNotify = RegisterDeviceNotification(this->GetSafeHwnd(), &NotificationFilter, DEVICE_NOTIFY_WINDOW_HANDLE);
    ....

    then I created a ::OnMyDeviceChange(WPARAM wParam, LPARAM lParam) function to handle these notifications.

    until here, everything is working fine.
    I can get the enumeration information from a DEV_BROADCAST_DEVICEINTERFACE structure. However, according to the documentation, I would also need a DEV_BROADCAST_VOLUME structure to get the drive letter from, but seems that it's not available at the moment I get notified of a device arrival.

    So I was wondering, what can I do to get the drive letter associated to that device arrival event?

    Namaste
    Last edited by Namaste; April 23rd, 2008 at 09:31 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center