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.

          Usage
          Reference
          Examples

        Usage

        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.


        Reference

          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);


        int CDRomCount;

          This value gives the number of installed CD-Roms on your system.

        int FixedDriveCount;

          This value gives the number of installed non removable drives on your system. Normally this is the number of hard disk partitions.

        int RemovableDriveCount;

          This value gives the number of removable drives on your system. These are MO drives, ZIP drives etc.

        int NetworkDriveCount;

          This value gives the number of drive letters that are assigned to network drives.

        AnsiString __fastcall GetCDRom(int index);

          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.

        AnsiString __fastcall GetFixedDrive(int index);

          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.

        AnsiString __fastcall GetRemovableDrive(int index);

          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.

        AnsiString __fastcall GetNetworkDrive(int index);

          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.

        void __fastcall ReInit(void);

          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.


        Examples

          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.


        Back