//得到光驱盘符:
procedure TForm1.Button1Click(Sender: TObject);
var
CDtype : UINT;
Name : CHAR;
DrvName : String;
volname, filesysname: PCHAR;
begin
GetMem(filesysname, 100);
for Name := 'C' to 'Z' do //循环检测A~Z
begin
DrvName := Name + ':';
CDtype := GetDriveType(PCHAR(@DrvName[1])); //获得磁盘类型
if (CDtype = DRIVE_CDROM) then
begin
ShowMessage('您的光驱盘符为[' + DrvName + ']');
end;
end;
FreeMem(filesysname)
end;