This sample shows how to implement progress indication in ZipForge.
Download ZipForge | Learn More | All Delphi samples
unit MainFrm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ComCtrls, ZipForge;
type
TMainForm = class(TForm)
Archiver: TZipForge;
pbProgress: TProgressBar;
btnExtract: TButton;
lblFile: TLabel;
procedure ArchiverOverallProgress(Sender: TObject; Progress: Double;
Operation: TZFProcessOperation; ProgressPhase: TZFProgressPhase;
var Cancel: Boolean);
procedure ArchiverFileProgress(Sender: TObject; FileName: WideString;
Progress: Double; Operation: TZFProcessOperation;
ProgressPhase: TZFProgressPhase; var Cancel: Boolean);
procedure btnExtractClick(Sender: TObject);
private
public
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
procedure TMainForm.ArchiverOverallProgress(Sender: TObject;
Progress: Double; Operation: TZFProcessOperation;
ProgressPhase: TZFProgressPhase; var Cancel: Boolean);
begin
pbProgress.Position := Trunc(Progress);
Application.ProcessMessages;
end;
procedure TMainForm.ArchiverFileProgress(Sender: TObject;
FileName: WideString; Progress: Double; Operation: TZFProcessOperation;
ProgressPhase: TZFProgressPhase; var Cancel: Boolean);
begin
lblFile.Caption := 'Extracting: ' + FileName;
Application.ProcessMessages;
end;
procedure TMainForm.btnExtractClick(Sender: TObject);
begin
Archiver.FileName := 'c:\test.zip';
Archiver.OpenArchive;
Archiver.BaseDir := 'c:\temp';
Archiver.ExtractFiles('*.*');
Archiver.CloseArchive;
end;
end.
Download ZipForge | Learn More | All Delphi samples
|