2017-02-22 15 views
2

一定時間後に "Finished"ページでインストーラを閉じる方法は?Inno Setup - 一定時間後に完成インストーラを終了するには?

これは、次のように解釈することもできます。何もしないで、インストーラーを終了するにはどうすればいいですか? (インストールを閉じる/キャンセルする)。これは可能ですか?

+0

なぜあなたはそれをしたいですか? –

+0

@MartinPrikryl私はMessageBoxTimeoutに似た機能を使いたいと思いますが、基本的には完成したページをページに入れて、インストールが完了するとしばらくして終了します。 –

答えて

3

「完了」ページが表示されたら、InnoTools InnoCallbackライブラリを使用してタイマーをセットアップします。

[Files] 
Source: "InnoCallback.dll"; Flags: dontcopy 

[Code] 

type 
    TTimerProc = procedure(HandleW, msg, idEvent, TimeSys: LongWord); 

function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): LongWord; 
    external '[email protected] stdcall'; 
function KillTimer(hWnd, nIDEvent: LongWord): LongWord; 
    external '[email protected] stdcall'; 

function WrapTimerProc(Callback: TTimerProc; ParamCount: Integer): LongWord; 
    external '[email protected]:InnoCallback.dll stdcall delayload'; 

var 
    PageTimeoutTimer: LongWord; 
    PageTimeout: Integer; 

procedure UpdateFinishButton; 
begin 
    WizardForm.NextButton.Caption := 
    Format(SetupMessage(msgButtonFinish) + ' - %ds', [PageTimeout]); 
end; 

procedure PageTimeoutProc(
    H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord); 
begin 
    if PageTimeout > 1 then 
    begin 
    Dec(PageTimeout); 
    UpdateFinishButton; 
    end 
    else 
    begin 
    WizardForm.NextButton.OnClick(WizardForm.NextButton); 
    end; 
end; 

procedure CurPageChanged(CurPageID: Integer); 
begin 
    if CurPageID = wpFinished then 
    begin 
    PageTimeout := 10; 
    UpdateFinishButton; 
    PageTimeoutTimer := SetTimer(0, 0, 1000, WrapTimerProc(@PageTimeoutProc, 4)); 
    end; 
end; 

function NextButtonClick(CurPageID: Integer): Boolean; 
begin 
    if CurPageID = wpFinished then 
    begin 
    KillTimer(0, PageTimeoutTimer); 
    PageTimeoutTimer := 0; 
    end; 
    Result := True; 
end; 

Timeout of Finished page


関連した質問:

関連する問題