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

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

问题描述

一段时间后如何在已完成页面关闭安装程序?

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

推荐答案

在显示"已完成"页面以触发关闭后设置计时器。

[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 function,您需要Inno安装程序6。如果您使用Inno安装程序5,则可以使用InnoTools InnoCallback库中的WrapCallback函数。


相关问题:

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

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