跳过Inno Setup中的“准备安装向导"页面 [英] Skip Preparing to Install Wizard page in Inno Setup
问题描述
参考问题基本或高级安装模式选择以跳过或使用高级选项页面,我需要跳过立即准备安装向导页面.
Referring to the question Basic or Advanced installation mode choice to skip or use advanced options pages, I need to skip the Preparing to Install wizard page now.
在我的情况下,显示此页面,因为一个或多个程序正在使用需要由安装程序替换的文件;因此安装程序会询问用户是否希望安装程序自动关闭应用程序并在安装结束时重新启动.
In my case this page is displayed because one or more programs are using files that need to be replaced by the installer; so the installer asks to the user if they want the setup to automatically close the applications and restart at the end of the setup.
我需要在基本模式下从设置过程中隐藏此页面,并且如果使用了某些文件,则安装程序会自动关闭使用它们的应用程序,而不会向用户提出任何要求.
I need that this page is hide from the setup process in Basic mode, and if some files are used, that the setup automatically closes the applications using them without asking anything to the user.
我尝试将ShouldSkipPage
编辑为:
function ShouldSkipPage(PageID: Integer): Boolean;
begin
{ If "Basic" mode is selected, skip Directory and Components pages }
Result :=
ModePage.Values[0] and
((PageID = wpSelectDir) or (PageID = wpSelectComponents) or (PageID = wpReady) or (PageID = wpPreparing));
end;
添加了(PageID = wpPreparing)
,但页面仍以基本"模式显示.
adding (PageID = wpPreparing)
but the page still displayed in Basic mode.
有没有一种方法可以使用Inno Setup来实现?
Is there a way to implement this using Inno Setup?
推荐答案
ShouldSkipPage
事件甚至没有被wpPreparing
调用.该页面不会被跳过.
ShouldSkipPage
event is not even called for wpPreparing
. That page is not to be skipped.
如果您仍然想跳过它,则必须使用以下黑客手段:
If you still want to skip it, you have to use hacks like these:
- How to skip all the wizard pages and go directly to the installation process?
- Inno Setup - How to close finished installer after a certain time?
采用第一种方法,您的代码将如下所示:
With the first approach, your code would look like:
[Code]
const
BN_CLICKED = 0;
WM_COMMAND = $0111;
CN_BASE = $BC00;
CN_COMMAND = CN_BASE + WM_COMMAND;
procedure CurPageChanged(CurPageID: Integer);
var
Param: Longint;
begin
{ If Basic mode is selected, skip Preparing page }
if (CurPageID = wpPreparing) and ModePage.Values[0] then
begin
Param := 0 or BN_CLICKED shl 16;
PostMessage(WizardForm.NextButton.Handle, CN_COMMAND, Param, 0);
end;
end;
这篇关于跳过Inno Setup中的“准备安装向导"页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!