void ShowDriveType( int nDriveIdx_i )
{
int nDriveType = RealDriveType( nDriveIdx_i, 0 );
switch( nDriveType )
{
case DRIVE_UNKNOWN:
// This is an unknown drive
AfxMessageBox( "Unknow drive type" );
break;
case DRIVE_NO_ROOT_DIR:
// This is an Invalid root path
AfxMessageBox( "Invalid root path" );
break;
case DRIVE_REMOVABLE:
// This is a Removable Drive
AfxMessageBox( "Removable Drive" );
break;
case DRIVE_FIXED:
// This is a fixed drive
AfxMessageBox( "Fixed Drive" );
break;
case DRIVE_REMOTE:
// This is a Network Drive
AfxMessageBox( "Network Drive" );
break;
case DRIVE_CDROM:
// This is a CD/DVD Drive
AfxMessageBox( "CD/DVD Drive" );
break;
case DRIVE_RAMDISK:
// This is a RAM disk drive
AfxMessageBox( "RAMDisk Drive" );
default:
break;
};
}
Tuesday, March 3, 2009
[VC++] Getting Drive type using RealDriveType()
Do you want to know what type of a drive is corresponding an index, there is a shell function RealDriveType() which will help you figuring out the same. This function will take first parameter as the drive index, for example if you pass drive index 1 that corresponds to A: if you pass drive index 3 that corresponds to C: similarly it will go on. See the below function for demonstrating how to know the drive type. If you pass a drive index to this function then it will show message box displaying the drive type. For example if you pass 3 it will show message box saying "Fixed Drive".
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment