TDriveInfo |
V1.00 (11-29-98) |
TDriveInfo is a component to wrap the GetLogicalDriveStrings() and the GetDriveType() functions. TDriveInfo gives informations about the number of installed CD-Roms and of fixed, removable and network drives. You can also get the paths for any of these drives.
TDriveInfo is a not visible component. Drop a copy of it onto a form or create a TDriveInfo object at run time:
TDriveInfo *driveInfo;
driveInfo=new TDriveInfo(this);
Now the properties and methods are accessable.
Properties
int CDRomCount;
int FixedDriveCount;
int RemovableDriveCount;
int NetworkDriveCount;
Methods
AnsiString __fastcall GetCDRom(int index);
AnsiString __fastcall GetFixedDrive(int index);
AnsiString __fastcall GetRemovableDrive(int
index);
AnsiString __fastcall GetNetworkDrive(int index);
void __fastcall ReInit(void);
This value gives the number of installed CD-Roms on your system.
This value gives the number of installed non removable drives on your system. Normally this is the number of hard disk partitions.
This value gives the number of removable drives on your system. These are MO drives, ZIP drives etc.
This value gives the number of drive letters that are assigned to network drives.
This call gives the path to a CD Rom, where 0<=index<CDRomCount. If index has a non valid value the string returned is empty.
This call gives the path to a fixed drive, where 0<=index<FixedDriveCount. If index has a non valid value the string returned is empty.
This call gives the path to a removable drive, where 0<=index<RemovableDriveCount. If index has a non valid value the string returned is empty.
This call gives the path to a network drive, where 0<=index<NetworkDriveCount. If index has a non valid value the string returned is empty.
This call reinitializes the data stored in the component. This data is assigned the first time you access any of the component's properties or methods. If after this the configuration changes you need to call ReInit() to force the component to reread the data. Configuration may change if network drives are added or removed, with Windows NT fixed drives can be added or removed, too.
driveInfo->GetRemovableDrive(); will bring a result of "A:\" on most systems.
driveInfo->GetFixedDrive(); will bring a result of "C:\" on most systems.
driveInfo->GetCDRom(); will bring a result of "D:\" on many machines.