0

古いゲーム(Command&Conquer 1、Win95エディション)のパッチを作成しています。場合によっては、パッチを実行するには、Pascalスクリプトで記述された関数を実行する必要があります。これにはかなり時間がかかる場合があります。

現時点では、ページが「インストール」ページに変更された時点でこれを実行します。したがって、ユーザーがすべてのオプションを選択してインストールを確認した後、インストーラーが実際にファイルの追加(および削除)を開始する直前です。

procedure CurPageChanged(CurPageID: Integer);
begin
    if (CurPageID = wpInstalling) then
    begin
        // Rename all saveg_hi.### files to savegame.###
        renameSaveGames();
        // clean up the ginormous files mess left behind if the game was installed from the 'First Decade' compilation pack
        cleanupTFD();
    end;
end;

ただし、プロセスがかなり長くなる可能性があるため、実際のインストールプログレスバーに何らかの方法で追加したいと思います。これを達成する方法はありますか?

4

1 に答える 1

6

ProgressGaugeのインストールページからを制御できますWizardForm。次のスクリプトでは、ループからプログレスバーを更新する方法を示しています(これはアクションに置き換えるだけです)。安全のために、カスタムアクションが実行される前に保存され、実行時に復元される最小、最大、位置などのプログレスバーの値があります。

[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;
于 2011-12-10T01:05:17.800 に答える