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图像数据压缩解压缩实例

Delphi字符串中取数字

进程隐藏的Delphi代码

Delphi树的一些操作

Delphi读写文本文件

Delphi实现使用tidhttp控件向https地址post请求

Delphi远程线程注入获取qq密码

Delphi httpget 判断链接是否可以访问

Delphi中url的汉字编码

Delphi mediaplayer循环播放mp3所有音乐文件问题?

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



打赏

取消

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

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

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

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

评论

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