谁能马上给各vclzip压缩和解压的例子!一个listbox放带压缩文件路径
edit.text放还没创建的*.zip
edit.text放还没创建的*.zip
解决方案 »
- 急,急,急,求一条SQL语句
- 如何用TOleContainer控件调用excel后修改单元格并打印SHEET?
- 跪求动态设置DCOMConnection(大侠们进来看看吧)
- Delphi能做到像DOTNET那样的界面吗
- 在ADOQuery中的UpdateBatch中的问题
- 高分求助!如何控制一个文件夹里的文件的排列顺序?例如:让文件按时间或名字排列?谢谢
- 如何控制局域网中其它机器中的某一程序的运行和关闭?
- 那位仁兄能告知大富翁论坛的网址???
- 使用DAO的CompactDatabase,当ACCESS数据库加有密码时应该怎样写?
- 有没有for delphi6的creport报表控件?
- 看似简单,没人回答对的问题
- 在线求助:怎么在adoquery.sql中输入一个变量。
procedure TForm1.Button1Click(Sender: TObject);
var
sp:tsavedialog; savefilename : String;
op:topendialog; i:integer;
begin
Memo1.Lines.Clear; op:=topendialog.Create(nil);
op.Options:=[ofAllowMultiSelect,ofReadOnly,ofPathMustExist, ofFileMustExist];
op.Execute;
if op.FileName<> '' then
for i:= 0 to Op.Files.Count-1 do
Memo1.Lines.Add(Op.Files.Strings[i]); op.Free;
sp:=tsavedialog.Create(nil);
sp.Filter:='Zip file|*.Zip';
sp.DefaultExt:='Zip';
sp.FileName := 'C:\Install'; //默认压缩的文件路径
try
if (sp.Execute) and (sp.FileName<>'') then savefilename:=sp.FileName else Abort;
finally
sp.Free;
end;
With VCLZip1 do
begin
ZipName := savefilename;
Password := 'test';
//ZipName := 'C:\BACKUP.ZIP';
// MultiZipInfo.MultiMode := mmBlocks;
// MultiZipInfo.FirstBlockSize := 700000;
// MultiZipInfo.BlockSize := 1457600;
for i := 0 to Memo1.Lines.Count -1 do
FilesList.Add(Memo1.Lines[i]);
Recurse := True;
Zip;
end;
end;解压缩:
procedure TForm1.Button2Click(Sender: TObject);
var
i : integer;
NumUnzipped : Integer;
sp:tsavedialog; savefilename : String; openfilename : string;
op:topendialog;
begin
op:=topendialog.Create(nil);
op.Options:=[ofAllowMultiSelect,ofReadOnly,ofPathMustExist, ofFileMustExist];
if (op.Execute) and (op.FileName<>'') then openfilename:=op.FileName else Abort;
With VCLUnZip1 do
begin
Memo1.Lines.Clear; ZipName := openfilename;
Password := 'test';
// ZipName := 'C:\BACKUP.ZIP'; // set the zip filename
ReadZip; // open it and read its information // List filenames in zip file for i := 0 to Count-1 do Memo1.Lines.Add( Filename[i] + #9 + Pathname[i] ); // extract some files // determine which files to unzip{ FilesList.Add( '*.cpp' ); // unzip all .cpp files
FilesList.Add( 'myprog.exe' ); // unzip myprog.exe
FilesList.Add( '?<0-9>*\*.h' ); // .h files, if 2nd letter of dir starts with digit only
FilesList.Add( Filename[Count-1] ); // extract last entry in zipfile
}
DoAll := True; // Don't unzip all files DestDir := 'D:\test'; // Set destination directory
RecreateDirs := True; // don't recreate directory structures
RetainAttributes := True; // Set attributes to original after unzipping NumUnzipped := Unzip; // Extract files, return value is the number of files actually unzipped end; showmessage(inttostr(NumUnzipped));
end;