这是我以前的一个function,应该是得到硬盘的驱动器号 你是要这个么??还是别的? function TForm3.LoadDrives:string; // read server logical drives var Drv:array [0..MAX_PATH] of Char; buf:Cardinal; Drives:string; i:integer; begin Drives:=''; Result:=''; buf:=MAX_PATH; GetLogicalDriveStrings(buf,Drv); //DRVµÃµ½È磺c:\<null>d:\<null><null> ¼ûmsdn for i:=0 to MAX_PATH do begin if (Drv[i]=#0) and (Drv[i+1]=#0) then exit; //ÓÃÓÚ×îºó½áÊø×Ö·û´® if Drv[i]<>#0 then Drives:=Drives+Drv[i] else begin Result:=Result+Drives; Drives:=''; end; end; end;
你是要这个么??还是别的?
function TForm3.LoadDrives:string; // read server logical drives
var
Drv:array [0..MAX_PATH] of Char;
buf:Cardinal;
Drives:string;
i:integer;
begin
Drives:='';
Result:='';
buf:=MAX_PATH;
GetLogicalDriveStrings(buf,Drv); //DRVµÃµ½È磺c:\<null>d:\<null><null> ¼ûmsdn
for i:=0 to MAX_PATH do
begin
if (Drv[i]=#0) and (Drv[i+1]=#0) then exit; //ÓÃÓÚ×îºó½áÊø×Ö·û´®
if Drv[i]<>#0 then Drives:=Drives+Drv[i]
else begin
Result:=Result+Drives;
Drives:='';
end;
end;
end;