VCLZip控件的简单使用


本文整理自网络,侵删。

 VCLZip压缩解压文件支持winzip,下面给个简单调用的例子,控件在本站可以下载:

uses VCLUnZip, 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;

相关阅读 >>

github上通过星级评估排名前10的最受欢迎的开源Delphi项目

Delphi webbrowser1 保存文档为 .html

Delphi返回一个汉字的unicode编码

Delphi实现身份证号码15到18位升位算法

Delphi查找程序坐标 获取鼠标 模拟鼠标

Delphi 调节音量代码

Delphi 结束360safe和360保险箱进程

Delphi 串口查询所有com口

Delphi d10.x 安卓app开发中按返回键后程序不退出程序的方法

Delphi 组件值实现增减

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...