使用Inno Setup静默运行安装,无需任何“下一步"按钮或“安装"按钮 [英] Run installation using Inno Setup silently without any Next button or Install button

查看:782
本文介绍了使用Inno Setup静默运行安装,无需任何“下一步"按钮或“安装"按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的安装应该保持静默状态,而无需用户单击任何 Next Install 按钮.我仍然尝试禁用所有页面,正在获得准备安装" 页面.我要避开此安装页面.

I want my installation should be silent without any Next or Install buttons clicked by the user. I tried to disable all pages still, I am getting the "Ready to Install" page. I want avoid this install page.

推荐答案

要运行Inno Setup内置的安装程序,而无需与用户进行任何交互,甚至没有任何窗口,请使用

To run an installer built in Inno Setup without any interaction with the user or even without any window, use the /SILENT or /VERYSILENT command-line parameters:

指示安装程序保持安静或非常安静.当安装程序处于静默状态时,不会显示向导和背景窗口,但是会显示安装进度窗口.如果安装程序非常安静,则不会显示此安装进度窗口.其他所有东西都是正常的,因此例如会显示安装过程中的错误消息并显示启动提示(如果您尚未使用DisableStartupPrompt或上面说明的'/SP-'命令行选项禁用它).

Instructs Setup to be silent or very silent. When Setup is silent the wizard and the background window are not displayed but the installation progress window is. When a setup is very silent this installation progress window is not displayed. Everything else is normal so for example error messages during installation are displayed and the startup prompt is (if you haven't disabled it with DisableStartupPrompt or the '/SP-' command line option explained above).


您也可以考虑使用/SUPPRESSMSGBOXES参数.


You may also consider using the /SUPPRESSMSGBOXES parameter.

如果要使安装程序无提示"运行而无需任何其他命令行开关,则可以:

If you want to make your installer run "silently" without any additional command-line switches, you can:

  • Use the ShouldSkipPage event function to skip most pages.
  • Use a timer to skip the "Ready to Install" page (which cannot be skipped using the ShouldSkipPage). You can use the technique shown in Inno Setup - How to close finished installer after a certain time?
[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
  SubmitPageTimer: LongWord;

procedure KillSubmitPageTimer;
begin
  KillTimer(0, SubmitPageTimer);
  SubmitPageTimer := 0;
end;  

procedure SubmitPageProc(H: LongWord; Msg: LongWord; IdEvent: LongWord; Time: LongWord);
begin
  WizardForm.NextButton.OnClick(WizardForm.NextButton);
  KillSubmitPageTimer;
end;

procedure CurPageChanged(CurPageID: Integer);
begin
  if CurPageID = wpReady then
  begin
    SubmitPageTimer := SetTimer(0, 0, 100, CreateCallback(@SubmitPageProc));
  end
    else
  begin
    if SubmitPageTimer <> 0 then
    begin
      KillSubmitPageTimer;
    end;
  end;
end;

function ShouldSkipPage(PageID: Integer): Boolean;
begin
  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.

另一种方法是将CN_COMMAND发送到 Next 按钮,如下所示:如何跳过所有向导页面并直接进入安装过程?

Another approach is to send CN_COMMAND to the Next button, as shown here: How to skip all the wizard pages and go directly to the installation process?

这篇关于使用Inno Setup静默运行安装,无需任何“下一步"按钮或“安装"按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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