10
インストール処理の完了率、経過時間、および推定時間値を表示したいとします。下のスクリーンショットにマークされているテキストラベルを追加する方法はありますか?完了率、経過時間、および予測経過時間を表示するにはどうすればよいですか?
インストール処理の完了率、経過時間、および推定時間値を表示したいとします。下のスクリーンショットにマークされているテキストラベルを追加する方法はありますか?完了率、経過時間、および予測経過時間を表示するにはどうすればよいですか?
CurInstallProgressChanged
イベントメソッドは、Inno Setupの5.5.4で導入された前に、この機能を実装することは容易ではなかったです。しかし、今このイベントを利用できるようにすると、次のようなスクリプトを書くことができます:
ロールバックプロセス時にラベルを隠す修正案については、user1662035に特別な感謝の気持ちがあります。
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Files]
Source: "MyProg.exe"; DestDir: "{app}"
Source: "MyProg.chm"; DestDir: "{app}"
Source: "Readme.txt"; DestDir: "{app}"
[Code]
function GetTickCount: DWORD;
external '[email protected] stdcall';
var
StartTick: DWORD;
PercentLabel: TNewStaticText;
ElapsedLabel: TNewStaticText;
RemainingLabel: TNewStaticText;
function TicksToStr(Value: DWORD): string;
var
I: DWORD;
Hours, Minutes, Seconds: Integer;
begin
I := Value div 1000;
Seconds := I mod 60;
I := I div 60;
Minutes := I mod 60;
I := I div 60;
Hours := I mod 24;
Result := Format('%.2d:%.2d:%.2d', [Hours, Minutes, Seconds]);
end;
procedure InitializeWizard;
begin
PercentLabel := TNewStaticText.Create(WizardForm);
PercentLabel.Parent := WizardForm.ProgressGauge.Parent;
PercentLabel.Left := 0;
PercentLabel.Top := WizardForm.ProgressGauge.Top +
WizardForm.ProgressGauge.Height + 12;
ElapsedLabel := TNewStaticText.Create(WizardForm);
ElapsedLabel.Parent := WizardForm.ProgressGauge.Parent;
ElapsedLabel.Left := 0;
ElapsedLabel.Top := PercentLabel.Top + PercentLabel.Height + 4;
RemainingLabel := TNewStaticText.Create(WizardForm);
RemainingLabel.Parent := WizardForm.ProgressGauge.Parent;
RemainingLabel.Left := 0;
RemainingLabel.Top := ElapsedLabel.Top + ElapsedLabel.Height + 4;
end;
procedure CurPageChanged(CurPageID: Integer);
begin
if CurPageID = wpInstalling then
StartTick := GetTickCount;
end;
procedure CancelButtonClick(CurPageID: Integer; var Cancel, Confirm: Boolean);
begin
if CurPageID = wpInstalling then
begin
Cancel := False;
if ExitSetupMsgBox then
begin
Cancel := True;
Confirm := False;
PercentLabel.Visible := False;
ElapsedLabel.Visible := False;
RemainingLabel.Visible := False;
end;
end;
end;
procedure CurInstallProgressChanged(CurProgress, MaxProgress: Integer);
var
CurTick: DWORD;
begin
CurTick := GetTickCount;
PercentLabel.Caption :=
Format('Done: %.2f %%', [(CurProgress * 100.0)/MaxProgress]);
ElapsedLabel.Caption :=
Format('Elapsed: %s', [TicksToStr(CurTick - StartTick)]);
if CurProgress > 0 then
begin
RemainingLabel.Caption :=
Format('Remaining: %s', [TicksToStr(
((CurTick - StartTick)/CurProgress) * (MaxProgress - CurProgress))]);
end;
end;
素晴らしい仕事、TLama、ありがとうございます!私は、ラベルを隠す唯一のソリューションは、カスタムメッセージボックスと手動でキャンセルを呼び出すことだと思う。たぶんこれはトリックです:[リンク](http://pastebin.com/SJwjVGvs)しかし、私はそれをテストしていない。 – user1662035
@ user1662035、はい、それは私が持っていた直接の思想でした。しかし、私はもっと正確なものを見ようとします。とにかく、準備完了の['ExitSetupMsgBox'](http://www.jrsoftware.org/ishelp/index.php?topic=isxfunc_exitsetupmsgbox)関数を使用して終了確認ダイアログを表示することができます。ただし、 "*セットアップを終了しますか?"とは異なるメッセージではありません。私はこの時点で手作業でInno Setupをチェックしていません。 – TLama
私はこの機能について完全に忘れていました...私は両方のバージョンをテストしたところ、両方とも通常の終了ダイアログを表示しました。私はあなたが「より正確に」ということを尋ねることができますか? – user1662035