我不想用控件,有什么办法嘛?我用 
file_name:='d:\htys\tmp_data.rar'; 
 dbpath := 'd:\tmp'; 
 aa:='winrar e -o+ '+file_name+' '+dbpath; 
 if not fileexists(file_name) then 
 begin 
   messagebox(handle,pchar(file_name+'文件不存在,无法进行解压缩操作!'),'提示信息',0); 
   exit; 
 end;  if winexec(pchar(aa),sw_hide)<=31 then 
 begin 
   messagebox(handle,'解压缩操作失败!','提示信息',0); 
   exit; 
 end; 
这个他提示解压失败呢,
  

解决方案 »

  1.   

    在delphi中,进行文件的zip压缩解压缩可以使用一个第三方控件VCLZip来完成。压缩:        vclzip:=TVCLZip.create(nil);        with vclzp do
            begin
              ZipName:=dstFile;
              RecreateDirs:=true; //注意这里
              StorePaths:=False;
              FilesList.Add(srcFile);
              Recurse := True;
              try
                Zip;
              except
                Application.MessageBox('压缩文件失败','错误',MB_OK+MB_ICONINFORMATION);
                exit;
              end;
            end;解压缩:vcluzip:=TVCLUnZip.Create(nil);
    with vcluzip do
    begin
        ZipName:=sFile;
        ReadZip;
        FilesList.Add('*.*');
        DoAll := False;
        DestDir := ExtractFilePath(sFile);
        RecreateDirs := False;
        RetainAttributes := True;
        Unzip;
    end;
    vcluzip.Free;
      

  2.   

    楼主你可以直接调用winrar对zip文件进行各项操作,也就是通过命令行参数去打开winrar,网上查一下具体的winrar的命令行参数吧
      

  3.   

    我按照哪里修改了,可是怎么还是不行啊
    file_name:='d:\pp.rar';   //解压的文件
     dbpath := '*.bak';       //压缩包里面的文件扩展名
     aa:='winrar e o+ '+file_name+' '+dbpath+'';  //解压,覆盖,,
     if not fileexists(file_name) then 
     begin 
       messagebox(handle,pchar(file_name+'文件不存在,无法进行解压缩操作!'),'提示信息',0); 
       exit; 
     end;  if winexec(pchar(aa),sw_hide)<=31 then
     begin 
       messagebox(handle,'解压缩操作失败!','提示信息',0);
       exit;
     end; 
      

  4.   

    你用这个相比用三方控件更不靠谱。
    winrar 是收费软件,并不是所有电脑都有安装它的。
    其实你可以调用  unrar.dll 来解压。
    但是,很多免费的开源的解 zip 文件的三方组件,为什么不用呢?如果你懒得安装三方控件,用 SciZipFile 这个类就是很好的选择。它不用安装,直接调用就行。
      

  5.   

    ZIP可以有VCL,但是rar,必须有unrar.dll除了好压,唔知如何实现
      

  6.   

    唉,还是装控件了,之前装的那个不知道去哪里了,unzip的,,,