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