Installation 将函数执行添加到inno安装程序的安装进度中

Installation 将函数执行添加到inno安装程序的安装进度中,installation,progress-bar,inno-setup,pascalscript,Installation,Progress Bar,Inno Setup,Pascalscript,我正在为一个老游戏(Command&Conquer 1,Win95 edition)制作补丁,在某些情况下,执行补丁需要执行一个用Pascal脚本编写的函数,这可能需要相当长的时间 目前,我在页面更改为“安装”页面时执行此操作,因此,在用户选择所有选项并确认安装后,安装程序开始实际添加(和删除)文件之前 但由于过程可能相当长,我更愿意以某种方式将其添加到实际安装进度栏中。有什么方法可以做到这一点吗?您可以从向导窗体的安装页面控制进度表。下面的脚本演示了如何从循环中更新进度条(您只需将其替换为操作

我正在为一个老游戏(Command&Conquer 1,Win95 edition)制作补丁,在某些情况下,执行补丁需要执行一个用Pascal脚本编写的函数,这可能需要相当长的时间

目前,我在页面更改为“安装”页面时执行此操作,因此,在用户选择所有选项并确认安装后,安装程序开始实际添加(和删除)文件之前


但由于过程可能相当长,我更愿意以某种方式将其添加到实际安装进度栏中。有什么方法可以做到这一点吗?

您可以从
向导窗体的安装页面控制
进度表。下面的脚本演示了如何从循环中更新进度条(您只需将其替换为操作)。为安全起见,在执行自定义操作之前保存进度条值,如“最小”、“最大”和“位置”,并在完成自定义操作后恢复

[Code]
procedure CurPageChanged(CurPageID: Integer);
var
  I: Integer;
  ProgressMin: Longint;
  ProgressMax: Longint;
  ProgressPos: Longint;
begin
  if CurPageID = wpInstalling then
  begin
    // save the original "configuration" of the progress bar
    ProgressMin := WizardForm.ProgressGauge.Min;
    ProgressMax := WizardForm.ProgressGauge.Max;
    ProgressPos := WizardForm.ProgressGauge.Position;

    // output some status and setup the min and max progress values
    WizardForm.StatusLabel.Caption := 'Doing my own pre-install...';
    WizardForm.ProgressGauge.Min := 0;
    WizardForm.ProgressGauge.Max := 100;
    // here will be your time consuming actions with the progress update
    for I := 0 to 100 do
    begin
      WizardForm.FilenameLabel.Caption := 'I''m on ' + IntToStr(I) + '%';
      WizardForm.ProgressGauge.Position := I;
      Sleep(50);
    end;

    // restore the original "configuration" of the progress bar
    WizardForm.ProgressGauge.Min := ProgressMin;
    WizardForm.ProgressGauge.Max := ProgressMax;
    WizardForm.ProgressGauge.Position := ProgressPos;
  end;
end;

您可以从
向导窗体的安装页面
控制
ProgressGauge
。下面的脚本演示了如何从循环中更新进度条(您只需将其替换为操作)。为安全起见,在执行自定义操作之前保存进度条值,如“最小”、“最大”和“位置”,并在完成自定义操作后恢复

[Code]
procedure CurPageChanged(CurPageID: Integer);
var
  I: Integer;
  ProgressMin: Longint;
  ProgressMax: Longint;
  ProgressPos: Longint;
begin
  if CurPageID = wpInstalling then
  begin
    // save the original "configuration" of the progress bar
    ProgressMin := WizardForm.ProgressGauge.Min;
    ProgressMax := WizardForm.ProgressGauge.Max;
    ProgressPos := WizardForm.ProgressGauge.Position;

    // output some status and setup the min and max progress values
    WizardForm.StatusLabel.Caption := 'Doing my own pre-install...';
    WizardForm.ProgressGauge.Min := 0;
    WizardForm.ProgressGauge.Max := 100;
    // here will be your time consuming actions with the progress update
    for I := 0 to 100 do
    begin
      WizardForm.FilenameLabel.Caption := 'I''m on ' + IntToStr(I) + '%';
      WizardForm.ProgressGauge.Position := I;
      Sleep(50);
    end;

    // restore the original "configuration" of the progress bar
    WizardForm.ProgressGauge.Min := ProgressMin;
    WizardForm.ProgressGauge.Max := ProgressMax;
    WizardForm.ProgressGauge.Position := ProgressPos;
  end;
end;

嗯。我真的应该深入研究那些定制页面。嗯。我真的应该深入研究那些定制页面。