procedure TForm1.Button1Click(Sender: TObject);
var
x:integer;
drive:char;
y:integer;
begin
x:=0;
y:=0;
x:=GetLogicalDrives();
repeat
x:= x div 2 ;
Y:=Y+1;
until x=1;
x:=0;
for drive:='a' to 'z' do
begin
Case GetDriveType(pchar(Drive+':/')) of
2: Label1.Caption :='软盘驱动器';
3: Label1.Caption := '硬盘驱动器';
4: Label1.Caption := '网络驱动器';
5: Label1.Caption := 'CD-ROM驱动器';
6: Label1.Caption := '虚拟驱动器';
Else Label1.Caption := '驱动器无效';
end;
if GetDriveType(pchar(Drive+':/'))in[2,3,4,5,6] then
ComboBox1.Items.Add(pchar(drive+':/ ')+label1.Caption);
x:=x+1;
if x>y then begin
showmessage(' Done !');
exit;
end;
end;
end;