Delphi VclZip用法详 .
本文共 1126 字,大约阅读时间需要 3 分钟。
- function Zip(ZipMode,PackSize:Integer;ZipFile,UnzipDir:String):Boolean;
- var ziper:TVCLZip;
- begin
-
-
- try
- if copy(UnzipDir, length(UnzipDir), 1) = '\' then
- UnzipDir := copy(UnzipDir, 1, length(UnzipDir) - 1);
- ziper:=TVCLZip.Create(application);
- ziper.DoAll:=true;
- ziper.OverwriteMode:=Always;
- if PackSize<>0 then begin
- ziper.MultiZipInfo.MultiMode:=mmBlocks;
- ziper.MultiZipInfo.SaveZipInfoOnFirstDisk:=True;
- ziper.MultiZipInfo.FirstBlockSize:=PackSize;
- ziper.MultiZipInfo.BlockSize:=PackSize;
- end;
- ziper.FilesList.Clear;
- ziper.ZipName := ZipFile;
- if ZipMode=0 then begin
- ziper.FilesList.Add(UnzipDir+'\*.*');
- Application.ProcessMessages;
- ziper.Zip;
- end else begin
- ziper.DestDir:= UnzipDir;
- ziper.UnZip;
- end;
- ziper.Free;
- Result:=True;
- except
- Result:=False;
- end;
- end;
转载于:https://www.cnblogs.com/wxb-km/archive/2012/11/28/2793413.html