Board index » delphi » drive letter is cd-rom

drive letter is cd-rom

Is there a function that can determine whether a drive letter is a CD-ROM
or not?

Thanks,
Koen.

 

Re:drive letter is cd-rom


You could find this out by accessing the BIOS, but I'm sure that there would
be an easier (and safer) way.

--
Peter Wilson
wils...@es.co.nz

Quote
"Koen Demuynck" <koendemuynck@hot*REM*mail.com> wrote in message

news:Xns91E7729E7FDD7koendemuynckhotmailc@195.238.3.180...
Quote
> Is there a function that can determine whether a drive letter is a CD-ROM
> or not?

> Thanks,
> Koen.

Re:drive letter is cd-rom


function IsCDDrive(Drv: char): boolean;
begin
  { Drv  'A'..'Z'  }
  result := GetDriveType(PChar(Drv +':\')) = DRIVE_CDROM;
end;
Quote
Koen Demuynck wrote:

> Is there a function that can determine whether a drive letter is a CD-ROM
> or not?

> Thanks,
> Koen.

Re:drive letter is cd-rom


Quote
Peter Wilson wrote in message ...
>You could find this out by accessing the BIOS, but I'm sure that there
would
>be an easier (and safer) way.

Actually, you couldn't.

Win9X lets you specifiy a range of letters to limit CD-ROM
drives to (I: to N: on all my machines), and Windows NT lets
you assign drive letters more or less arbitrarily to all
drives.

The BIOS might tell you that the master device on the secondary
IDE interface is a CD-ROM player, but that's about it.

Groetjes,
Maarten Wiltink

Re:drive letter is cd-rom


To find the drive letter(s) of the cdrom(s) modify the following code (which uses a memo component to write the results to:

procedure GetDrives;
var
    Drive,Memo : string;
    ch: char;
begin
    mmoDrives.Clear;

    for ch := 'A' to 'Z' do
    begin
        Drive := ch + ':\';
        Memo := ch + ': is ';
        case GetDriveType(PChar(Drive)) of
             0              : Memo := Memo + 'unknown';
             1              : Memo := 'NON-EXISTENT';
             DRIVE_REMOVABLE: Memo := Memo + 'removable';
             DRIVE_FIXED    : Memo := Memo + 'fixed';
             DRIVE_REMOTE   : Memo := Memo + 'networked';
             DRIVE_CDROM    : Memo := Memo + 'a CDROM';
             DRIVE_RAMDISK  : Memo := Memo + 'a RAMdisk';
        end;
        if Memo <> 'NON-EXISTENT' then
            mmoDrives.Lines.Add(Memo);
    end;
end;

Cheers

Lino

Greg Vinall
IT Administrator Riverina/Western Region
Technology & Information Management
_______________________________

NSW Department of Public Works and Services
Riverina/Western Regional Office
140 William Street
Bathurst NSW 2795

Phone:  02 6339 5908
Fax:      02 6339 5949  
Mobile:  0408 633 729
E-mail:  gregory.vin...@dpws.nsw.gov.au                

DPWS - Delivering Solutions
_______________________________

Other Threads