To know that disk type is for its unit letter (CDrom, HD, etc):  

Send By: Q3 Team
Web :
Date: 23/06/99

Tip accessed 621 times


Easy using this function:

       function TipoDeDisco(RaizDisco: string): string;
         i: word;
         i := GetDriveType(PChar(LowerCase(RaizDisco)));
         case i of
           { Unknown }
           0:               result := 'no puedo determinarlo';
           { it doesn't exist }
           1:               result := 'no existe';
           { Floppy }
           DRIVE_REMOVABLE: result := 'floppy/extraible';
           { Fixed }
           DRIVE_FIXED:     result := 'disco fijo';	
           { Net unit }
           DRIVE_REMOTE:    result := 'unidad de red';
           { CD-ROM }
           DRIVE_CDROM:     result := 'cd-rom';
           { Ram Drive }
           DRIVE_RAMDISK:   result := 'disco-ram';

For example, put a TLabel in you form (Label1) and call to the function with:


Another example:

Let us suppose that we want to know if the C: \ it is or not a hard disk:

      if GetDriveType(PChar('c:\')))=DRIVE_FIXED then {Si, es un HD};

You could also use it to find the unit of CD-ROM of the PC (but care, is not enough with which you look
for the first one that you find, it could have more than one installed).
If your application extracts data of a CD-ROM and you need to know if it is inserted and in that unit, first
you can look for all the type units cd-rom, and, finally, to look for in all them a certain file that you know
that it exists in your CD-ROM, there won't be this way doubts.