Inno Setup-如何在一段时间后关闭完成的安装程序? [英] Inno Setup - How to close finished installer after a certain time?

查看:75
本文介绍了Inno Setup-如何在一段时间后关闭完成的安装程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一定时间后如何关闭完成"页面上的安装程序?

How to close the installer on the "Finished" page after a certain time?

它也可以解释为:一段时间不活动后如何关闭安装程序? (关闭/取消安装).这可能吗?

It could also be interpreted as: how to close the installer after some time of non-activity? (close/cancel install). Is this possible?

推荐答案

一旦完成"页面显示以触发关闭,请设置计时器.

Setup a timer once the "Finished" page displays to trigger the close.

[Code]

function SetTimer(hWnd, nIDEvent, uElapse, lpTimerFunc: LongWord): LongWord;
  external 'SetTimer@User32.dll stdcall';
function KillTimer(hWnd, nIDEvent: LongWord): LongWord;
  external 'KillTimer@User32.dll stdcall';

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, CreateCallback(@PageTimeoutProc));
  end;
end;

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

对于 CreateCallback函数,您需要Inno设置6.如果您对Inno Setup 5不满意,则可以使用 InnoTools中的WrapCallback函数InnoCallback 库.

For CreateCallback function, you need Inno Setup 6. If you are stuck with Inno Setup 5, you can use WrapCallback function from InnoTools InnoCallback library.

相关问题:

  • MsgBox - Make unclickable OK Button and change to countdown - Inno Setup;
  • Inno Setup - Automatically submitting uninstall prompts.

这篇关于Inno Setup-如何在一段时间后关闭完成的安装程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆