zoukankan      html  css  js  c++  java
  • VCLZIP 使用

    function ComPressFile(dstFile,srcFile:string):Boolean;
    var
      vclzip:TVCLZip;
    begin
      Result:=False;
      vclzip:=TVCLZip.create(nil);
      try
        with vclzip do
        begin
          try
            ZipName:=dstFile;
            RecreateDirs:=true; //注意这里
            StorePaths:=False;
            FilesList.Add(srcFile);
            Recurse := True;
            Zip;
            Result:=True;
          except
            Application.MessageBox('压缩文件失败','错误',MB_OK+MB_ICONINFORMATION);
            Result:=False;
            exit;
          end;
        end;
      finally
        vclzip.Free;
      end;
    end;
    
    function UnComPressFile(sFile,sOutFile:string):Boolean;
    var
      vcluzip:TVCLUnZip;
    begin
      Result:=False;
      vcluzip:=TVCLUnZip.Create(nil);
      try
        with vcluzip do
        begin
          try
            ZipName:=sFile;
            ReadZip;
            FilesList.Add('*.*');
            DoAll := False;
            DestDir := sOutFile;
            RecreateDirs := False;
            RetainAttributes := True;
            Unzip;
            Result:=True;
          except
            Application.MessageBox('解压文件失败','错误',MB_OK+MB_ICONINFORMATION);
            Result:=False;
            exit;
          end;
        end;
      finally
        vcluzip.Free;
      end;
    end;
    

  • 相关阅读:
    #pragma
    STL~heap
    codeforces682A
    POJ1753(位操作和枚举)
    位运算
    getchar()(转)
    UVA2636
    UVA2639
    UVA2322
    UVa2521
  • 原文地址:https://www.cnblogs.com/brightsea/p/2034981.html
Copyright © 2011-2022 走看看