请写详细代码
谢谢

解决方案 »

  1.   

    function  CheckIsCdrom():string;
    var
      i,x:integer;
      pDriver:pchar;
    begin
       result:='no';
       for i:=65 to 90  do
       begin
          pDriver:=pchar(chr(i)+':\');
          x := GetDriveType(pDriver);
          if x=5 then
          begin
             result:=chr(i);
             break;
          end;
       end;
    end;
      

  2.   

    function GetDriveSpecies(Drive: string): string;
    begin
      case GetDriveType(PChar(Drive)) of//获得Drive所对应的磁盘驱动器信息
        0:               Result := '不确定的驱动器类型';
        1:               Result := '驱动器‘'+Drive+'’不存在';
        DRIVE_REMOVABLE: Result := '软盘驱动器';
        DRIVE_FIXED :    Result := '硬盘驱动器';
        DRIVE_REMOTE:    Result := '网络驱动器';
        DRIVE_CDROM:     Result := '光盘驱动器';
        DRIVE_RAMDISK:   Result := '内存虚拟盘';
      end;
    end;
      

  3.   

    darkliu(钢铁工人甲)真厉害,全了
      

  4.   

    参考下面代码
    --------------------------
    procedure TForm1.InfoClick(Sender: TObject);
    type
      tdrivetype=(dtunknown,dtnodrive,dtfloppy,dtfixed,dtnetwork,dtcdrom,dtram);
    var
      drivenum:integer;
      drivechar:char;
      drivetype:tdrivetype;
      drivebits:set of 0..25;
      drv:string;
    begin
      integer(drivebits):=getlogicaldrives;
      for drivenum:=0 to 25 do
        begin
          if not (drivenum in drivebits) then continue;
          drivechar:=char(drivenum+ord('A'));
          drivetype:=tdrivetype(getdrivetype(pchar(drivechar+':\')));
          drv:='';
          case drivetype of
    {      dtunknown:drv:=drivechar+':\> is Unknown';
          dtnodrive:drv:=drivechar+':\> is NoDrive';
          dtfloppy: drv:=drivechar+':\> is Floppy';
          dtfixed:  drv:=drivechar+':\> is Fixed';
          dtnetwork:drv:=drivechar+':\> is NetWork'; }
          dtcdrom:  drv:=drivechar+':\> is CD-ROM'; // is CDROM
    //      dtram:    drv:=drivechar+':\> is RAM';
          end;
          if drv<>'' then
          showmessage(drv);
        end;
    end;
      

  5.   

    function GetDriveSpecies(Drive: string): string;
    begin
      case GetDriveType(PChar(Drive)) of//获得Drive所对应的磁盘驱动器信息
        0:               Result := '不确定的驱动器类型';
        1:               Result := '驱动器‘'+Drive+'’不存在';
        DRIVE_REMOVABLE: Result := '软盘驱动器';
        DRIVE_FIXED :    Result := '硬盘驱动器';
        DRIVE_REMOTE:    Result := '网络驱动器';
        DRIVE_CDROM:     Result := '光盘驱动器';
        DRIVE_RAMDISK:   Result := '内存虚拟盘';
      end;
    end;不错呀!