zoukankan      html  css  js  c++  java
  • VCLZIP样例

    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;

  • 相关阅读:
    【DevExpress v17.2新功能预告】DevExtreme TreeList
    MyEclipse WebSphere开发教程:安装和更新WebSphere 6.1, JAX-WS, EJB 3.0(六)
    【DevExpress v17.2新功能预告】改进DevExtreme编辑器
    MyEclipse WebSphere开发教程:安装和更新WebSphere 6.1, JAX-WS, EJB 3.0(五)
    DevExpress DateEdit 5 常见问题解决方法
    CSS五种方式实现 Footer 置底
    css中雪碧图(sprite)的使用及制作方法
    CSS实现垂直居中的5种方法
    如何使用CSS创建巧妙的动画提示框
    css定位方式有哪几种?
  • 原文地址:https://www.cnblogs.com/rayz/p/2913765.html
Copyright © 2011-2022 走看看