-
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
-
Re: Not solved
really i have been trying for the past 3 days..
can anybody help me
-
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
-
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