【发布时间】:2020-10-29 16:54:41
【问题描述】:
我希望我的安装应该是静默的,没有用户单击任何 Next 或 Install 按钮。我仍然尝试禁用所有页面,我得到了 “准备安装” 页面。我想避免这个安装页面。
【问题讨论】:
-
对于类似的问题有不同的答案,请参阅How to make the silent installation by using Inno Setup?
我希望我的安装应该是静默的,没有用户单击任何 Next 或 Install 按钮。我仍然尝试禁用所有页面,我得到了 “准备安装” 页面。我想避免这个安装页面。
【问题讨论】:
要在不与用户进行任何交互甚至没有任何窗口的情况下运行 Inno Setup 中内置的安装程序,请使用 /SILENT or /VERYSILENT command-line parameters:
指示安装程序保持安静或非常安静。当安装程序处于静默状态时,不会显示向导和背景窗口,但会显示安装进度窗口。当安装程序非常安静时,不会显示此安装进度窗口。其他一切正常,例如在安装过程中会显示错误消息,并且启动提示是(如果您没有使用 DisableStartupPrompt 或上面解释的“/SP-”命令行选项禁用它)。
您也可以考虑使用/SUPPRESSMSGBOXES 参数。
如果您想让安装程序“静默”运行而无需任何额外的命令行开关,您可以:
ShouldSkipPage event function 跳过大部分页面。ShouldSkipPage 无法跳过该页面)。您可以使用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 function,你需要 Inno Setup 6。如果你被 Inno Setup 5 卡住了,你可以使用 InnoTools InnoCallback 库中的 WrapCallback 函数。
另一种方法是将CN_COMMAND发送到下一步按钮,如下所示:How to skip all the wizard pages and go directly to the installation process?
【讨论】: