showcds.pp 418 B

12345678910111213141516171819202122
  1. program showcds;
  2. {$mode objfpc}
  3. {$h+}
  4. uses cdrom,sysutils;
  5. Var
  6. Drives : Array[1..10] of String;
  7. I,Count : Integer;
  8. begin
  9. Try
  10. Count:=GetCDRomDevices(Drives);
  11. Writeln('This PC has ',count,' CD-ROM drives');
  12. For I:=1 to count do
  13. Writeln('Drive ',i,' on device: ',Drives[i]);
  14. Except
  15. On E : exception do
  16. Writeln(E.ClassName,' exception caught with message: ',E.Message);
  17. end;
  18. end.