Board index » delphi » how to find the Cd-Rom Drive?

how to find the Cd-Rom Drive?

How to dedect the cd-rom drive number?

FJV.
Thanks

 

Re:how to find the Cd-Rom Drive?


Quote
FJV wrote:
> How to dedect the cd-rom drive number?

Try that

=== boc ===
function DriveTypes(const DriveType: integer): TStringList;
{ DriveType can be:
    DRIVE_REMOVABLE
    DRIVE_FIXED
    DRIVE_REMOTE
    DRIVE_CDROM
    DRIVE_RAMDISK }
var
  lpDrives: array[1..255] of char;
  lstDrives: TStringList;
  intCount: integer;
  intLength: integer;
begin
  Result:= TStringList.Create;
  lstDrives:= TStringList.Create;
  { Get all drives }
  intLength:= GetLogicalDriveStrings(255, @lpDrives);
  for intCount:= 1 to intLength - 2 do
  begin
    if (intCount mod 4) = 1 then
      lstDrives.Add(Copy(lpDrives, intCount, 3));
  end;
  { count lpDrives of requested type }
  for intCount:= 0 to lstDrives.Count - 1 do
  begin
    if integer(GetDriveType(PChar(lstDrives[intCount]))) = DriveType
      then Result.Add(Copy(lstDrives[intCount], 1, 2));
  end;
  lstDrives.Free;
end;
=== eoc ===

Regards,
Udo
--
Please reply to newsgroup. No PMs unless requested.

Other Threads