来自:beta, 时间:2002-03-24 14:06:00, ID:999696<br><br>function GetCDRom: string; <br>var <br>c: Char; <br>Drive: string; <br>DriveType: UINT; <br>DriveSize: Int64; <br>begin <br>for c := 'A' to 'Z' do <br>begin <br>DriveSize := DiskSize(Ord(c) - Ord('A') + 1); <br>if DriveSize > 0 then <br>begin <br>Drive := c + ':'; <br>DriveType := GetDriveType(PChar(Drive)); <br>if DriveType = DRIVE_CDROM then <br>begin <br>Result := Drive; <br>Exit; <br>end; <br>end <br>else <br>if c >= 'C' then <br>Exit; <br>end; <br>end;<br> <br> <br>来自:kingdeezj, 时间:2002-03-24 14:51:00, ID:999733 <br><br>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;