Chinaunix首页 | 论坛 | 博客
  • 博客访问: 8324909
  • 博文数量: 1413
  • 博客积分: 11128
  • 博客等级: 上将
  • 技术积分: 14685
  • 用 户 组: 普通用户
  • 注册时间: 2006-03-13 10:03
个人简介

follow my heart...

文章分类

全部博文(1413)

文章存档

2013年(1)

2012年(5)

2011年(45)

2010年(176)

2009年(148)

2008年(190)

2007年(293)

2006年(555)

分类:

2006-09-22 16:20:35

[点评:这个例子真是太棒了,几乎演示了vclzip所有的功能.]
clzip开发实例
关键字:
分类 : 项目案例分析
密级 : 公开
(评分: , 回复: 0, 阅读: 54) »»
//压缩
procedure TForm1.FlatButton1Click(Sender: TObject);
var
FilePath:String;
// numberzip:Smallint;
begin
FilePath:=ExtractFilePath(Application.ExeName)+'顺德';
{ Thread1:=TShowProgress.create(FilePath); //创建线程计算总目录
Thread1.Priority:=tpNormal;
Thread1.FreeOnTerminate:=True;
}

FilePath:=ExtractFilePath(Application.ExeName)+'sd.cab';
VCLZip1.ZipName:=FilePath;

// FilePath:=ExtractFilePath(Application.ExeName)+'顺德\*.*';
FilePath:='.\顺德\*.*';
VCLZip1.FilesList.Add(FilePath);

VCLZip1.Recurse:=True;
VCLZip1.StorePaths:=True;
VCLzip1.PackLevel:=9;

// VCLZip1.Password:='944500';

try
VCLZip1.Zip;
Except
showmessage('Error!');
end;

MessageBox(0,'压缩成功','成功',MB_OK+MB_ICONINFORMATION);
end;
//解压缩 MemoPad,TMemo控件
procedure TForm1.FlatButton2Click(Sender: TObject);
var
FilePath:string;
NumUnzipped:integer;
i:integer;
begin
FilePath:=ExtractFilePath(Application.ExeName)+'sd.cab';

with VCLUnZip1 do
begin
ZipName := Filepath; // set the zip filename
ReadZip; // open it and read its information

FilesList.Add('*.*');
FilesList.Add( Filename[Count-1] ); // extract last entry in zipfile

DoAll := False; // Don't unzip all files

FilePath:='D:\王锋\Setup';
DestDir :=FilePath ; // Set destination directory
RecreateDirs := True; // don't recreate directory structures
RetainAttributes := True; // Set attributes to original after unzipping

MemoPad.Clear;
MemoPad.Lines.Add(VCLUnZip1.Filename[CountUnzip]);
NumUnzipped := Unzip; // Extract files, return value is the number of files actually unzipped
MessageBox(0,'压缩成功','成功',MB_OK+MB_ICONINFORMATION);
end;
end;
阅读(2937) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~