获取第一个光驱盘符
2006-02-04 13:53:34 来源:WEB开发网核心提示:{***Get the First CD ROM ***}function GetCDROM():string;var str:string; Drivers:Integer; driver:char; i,temp:integer;begin Drivers:=GetLogicalDrives; temp
{
***************************************
Get the First CD ROM
***************************************
}
function GetCDROM():string;
var
str:string;
Drivers:Integer;
driver:char;
i,temp:integer;
begin
Drivers:=GetLogicalDrives;
temp:=(1 and Drivers);
for i:=0 to 26 do
begin
if temp=1 then
begin
driver:=char(i+integer('a'));
str:=driver+':';
if GetDriveType(pchar(str))=DRIVE_CDROM then
begin
GetCDROM:=driver;
exit;
end;
end;
drivers:=(drivers shr 1);
temp:=(1 and Drivers);
end;
end;
***************************************
Get the First CD ROM
***************************************
}
function GetCDROM():string;
var
str:string;
Drivers:Integer;
driver:char;
i,temp:integer;
begin
Drivers:=GetLogicalDrives;
temp:=(1 and Drivers);
for i:=0 to 26 do
begin
if temp=1 then
begin
driver:=char(i+integer('a'));
str:=driver+':';
if GetDriveType(pchar(str))=DRIVE_CDROM then
begin
GetCDROM:=driver;
exit;
end;
end;
drivers:=(drivers shr 1);
temp:=(1 and Drivers);
end;
end;
更多精彩
赞助商链接