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;

相关阅读 >>

Delphi 10.4.1 edgebrowser 模拟操作网页方法

快速上手Delphi三十六计之输入处理篇

Delphi fmx使用 timage 显示动画图片

Delphi firedac tfddatamove 导出csv

Delphi的tclientsocket组件和tserversocket组件(c/s)说明

Delphi 打开android应用信息

idhttp使用时内存猛增,如何解决

Delphi的tfilestream

Delphi 用正则表达式检查一个串是否是电信的手机号

Delphi-获取毫秒-计算代码运行的时间

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



打赏

取消

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

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

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

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

评论

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