Results 1 to 4 of 4

Thread: Not solved

  1. #1
    Join Date
    Apr 2010
    Posts
    48
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Not solved

    Hi ..

    I am using Qt with win32..

    I can able to get notified on new device insertion and removal using DBT_DEVTYP_DEVICEINTERFACE

    if ( DBT_DEVICEARRIVAL == wParam || DBT_DEVICEREMOVECOMPLETE == wParam )
    {
    PDEV_BROADCAST_HDR pHdr = ( PDEV_BROADCAST_HDR )lParam;

    PDEV_BROADCAST_DEVICEINTERFACE pDevInf;

    PDEV_BROADCAST_VOLUME pDevVolume = reinterpret_cast<PDEV_BROADCAST_VOLUME>(lParam);

    switch( pHdr->dbch_devicetype )
    {
    case DBT_DEVTYP_DEVICEINTERFACE:
    pDevInf = ( PDEV_BROADCAST_DEVICEINTERFACE )pHdr;
    updateDevice( pDevInf, wParam);
    break;
    }
    }
    anybody please tell me how can i get the drive information ( G:/ ) for the above notication
    Last edited by newb; 28th June 2010 at 11:22.

  2. #2
    Join Date
    Apr 2010
    Posts
    48
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Not solved

    really i have been trying for the past 3 days..

    can anybody help me
    Last edited by newb; 28th June 2010 at 11:23.

  3. #3
    Join Date
    Apr 2010
    Posts
    34
    Thanks
    1
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Solved

    I'm afraid you're not at the right forum. The code you've provided is from win api. Try some win32 related forum, some like this one: http://social.msdn.microsoft.com/For...owssdk/threads

  4. #4
    Join Date
    Mar 2007
    Posts
    5
    Thanked 2 Times in 2 Posts
    Qt products
    Qt/Embedded
    Platforms
    MacOS X Windows

    Default Re: Solved

    Maybe you have the solution by now.
    I use something like this to get the drive letter for CD insert and removal.
    I think it might work for any device.

    static char FirstDriveFromMask (ULONG unitmask)
    {
    char i;

    for (i = 0; i < 26; ++i)
    {
    if (unitmask & 0x1)
    break;
    unitmask = unitmask >> 1;
    }

    return (i + 'A');

    }

    In your code ...
    PDEV_BROADCAST_HDR pHdr = ( PDEV_BROADCAST_HDR )lParam;
    PDEV_BROADCAST_VOLUME pvol= (PDEV_BROADCAST_VOLUME) pHdr;
    char Drive_Letter = FirstDriveFromMask(pvol->dbcv_unitmask);

    Good luck

Similar Threads

  1. How to get the Drive letter
    By newb in forum Qt Programming
    Replies: 10
    Last Post: 10th June 2010, 13:59
  2. Qt Designer Working from network drive
    By list@ceepro.dk in forum Qt Tools
    Replies: 1
    Last Post: 9th April 2010, 19:26
  3. How to get system drive?
    By Raccoon29 in forum General Programming
    Replies: 2
    Last Post: 23rd November 2008, 14:13
  4. Need help on mount nfs drive in Qt
    By tho97 in forum Qt Programming
    Replies: 3
    Last Post: 28th November 2007, 19:26
  5. problem of how to get drive
    By jyoti in forum General Programming
    Replies: 6
    Last Post: 30th November 2006, 14:18

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.