char cr[3];
char lable[12];
for(int n=0;n<=25;n++)
{
CString str;
str.Format("%c:",n+'A');
strcpy(cr,str);
int dt = GetDriveType(cr);
int succeed = GetVolumeInformation(cr,lable,12,NULL,NULL,NULL,NULL,0);
switch(dt)
{
case DRIVE_UNKNOWN:
{
str.Format("(%s) %s is DRIVE_UNKNOWN!",lable,cr);
break;
}
case DRIVE_REMOVABLE:
{
if(succeed)
{
str.Format("(%s) %s is DRIVE_REMOVABLE!",lable,cr);
}
else
{
str.Format("%s is DRIVE_REMOVABLE!",cr);
}
break;
}
case DRIVE_FIXED:
{
str.Format("(%s) %s is DRIVE_FIXED!",lable,cr);
break;
}
case DRIVE_REMOTE:
{
str.Format("(%s) %s is DRIVE_REMOTE!",lable,cr);
break;
}
case DRIVE_CDROM:
{
str.Format("(%s) %s is DRIVE_CDROM!",lable,cr);
break;
}
case DRIVE_RAMDISK:
{
str.Format("(%s) %s is DRIVE_RAMDISK!",lable,cr);
break;
}
default:
{
str.Empty();
break;
}
}
if(!str.IsEmpty())
{
AfxMessageBox(str);
}
}
char lable[12];
for(int n=0;n<=25;n++)
{
CString str;
str.Format("%c:",n+'A');
strcpy(cr,str);
int dt = GetDriveType(cr);
int succeed = GetVolumeInformation(cr,lable,12,NULL,NULL,NULL,NULL,0);
switch(dt)
{
case DRIVE_UNKNOWN:
{
str.Format("(%s) %s is DRIVE_UNKNOWN!",lable,cr);
break;
}
case DRIVE_REMOVABLE:
{
if(succeed)
{
str.Format("(%s) %s is DRIVE_REMOVABLE!",lable,cr);
}
else
{
str.Format("%s is DRIVE_REMOVABLE!",cr);
}
break;
}
case DRIVE_FIXED:
{
str.Format("(%s) %s is DRIVE_FIXED!",lable,cr);
break;
}
case DRIVE_REMOTE:
{
str.Format("(%s) %s is DRIVE_REMOTE!",lable,cr);
break;
}
case DRIVE_CDROM:
{
str.Format("(%s) %s is DRIVE_CDROM!",lable,cr);
break;
}
case DRIVE_RAMDISK:
{
str.Format("(%s) %s is DRIVE_RAMDISK!",lable,cr);
break;
}
default:
{
str.Empty();
break;
}
}
if(!str.IsEmpty())
{
AfxMessageBox(str);
}
}