Inno设置 - 如何显示完成百分比,经过时间和.arc减压的预计时间进度?

时间:2017-03-31 13:18:37

标签: inno-setup compression

如何在.arc减压中显示完成百分比,已用时间和预计时间进度?我正在尝试使用此代码的一部分How to add .arc decompression to Inno Setup?(百分比)将其添加到Inno Setup - How to add multiple arc files to decompress?

我正在尝试将ISDone的代码用于我的脚本。 ISDone代码使用函数:

function ProgressCallback(OveralPct,CurrentPct: integer;CurrentFile,TimeStr1,TimeStr2,TimeStr3:PAnsiChar): longword;
begin
  if OveralPct<=1000 then ISDoneProgressBar1.Position := OveralPct;
  LabelPct1.Caption := IntToStr(OveralPct div 10)+'.'+chr(48 + OveralPct mod 10)+'%';
  LabelCurrFileName.Caption:=ExpandConstant('{cm:ExtractedFile} ')+MinimizePathName(CurrentFile, LabelCurrFileName.Font, LabelCurrFileName.Width-ScaleX(100));
  LabelTime1.Caption:=ExpandConstant('{cm:ElapsedTime} ')+TimeStr2;
  LabelTime2.Caption:=ExpandConstant('{cm:RemainingTime} ')+TimeStr1;
  LabelTime3.Caption:=ExpandConstant('{cm:AllElapsedTime}')+TimeStr3;
  Result := ISDoneCancel;
end;

这是为了定义标签的位置:

procedure CreateControls;
begin
  LabelTime1 := TLabel.Create(WizardForm);
  with LabelTime1 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := ISDoneProgressBar1.Width div 2;
    Left     := ScaleX(0);
    Top      := PBTop + ScaleY(35);
  end;
  LabelTime2 := TLabel.Create(WizardForm);
  with LabelTime2 do begin
    Parent   := WizardForm.InstallingPage;
    AutoSize := False;
    Width    := LabelTime1.Width+ScaleX(40);
    Left     := ISDoneProgressBar1.Width div 2;
    Top      := LabelTime1.Top;
  end;
  LabelTime3 := TLabel.Create(WizardForm);
  with LabelTime3 do begin
    Parent   := WizardForm.FinishedPage;
    AutoSize := False;
    Width    := 300;
    Left     := 180;
    Top      := 200;
  end;
end;

此代码是ISDone 0.6代码的一部分。

1 个答案:

答案 0 :(得分:0)

我假设您需要freearc提取以及ISDone的时间标签功能?如果是这样,您不必同时使用ISDone代码和ISFreeArcExtract代码,因为ISDone已实现Freearc提取。您可以使用ISArcExract函数来解压缩.arc文件。这是函数定义

function ISArcExtract(CurComponent:Cardinal; PctOfTotal:double; InName, OutPath, ExtractedPath: AnsiString; DeleteInFile:boolean; Password, CfgFile, WorkPath: AnsiString; ExtractPCF: boolean ):boolean; external 'ISArcExtract@files:ISDone.dll stdcall delayload';

这就是你如何使用它。以下代码可以在脚本的 CurStepChanged 过程中找到。您可以添加多个包含多个弧文件的行和 PctOfTotal ,以表示特定弧文件在整体安装中将占用的百分比为100%。

if not ISArcExtract ( 0, 10, ExpandConstant('{src}\data.arc'), ExpandConstant('{app}\'), '', false, '', '', ExpandConstant('{app}'), notPCFonFLY {PCFonFLY}) then break;

此处data.arc将被提取为freearc存档,并将消耗10%的安装费用。

请注意,上述部分取自ISDone 0.6

相关问题