How to skip all the wizard pages and go directly t

2019-02-14 06:12发布

At this time I'm using 3 wizard pages (Preparing to Install, Installing and Finished page) in my installer.

I want to keep the process as simple as possible, so I would like to reduce this to just 2 pages (Installing and Finished page).

Is there a way to skip all the wizard pages and go directly to the installation process when the installer starts ?

标签: inno-setup
2条回答
手持菜刀,她持情操
2楼-- · 2019-02-14 06:54

You cannot jump straight to Installing in an interactive (user directly ran the installer) context. Inno requires that at least one page be shown beforehand to allow the user to cancel the installation. It's up to you which page it shows, but there must be at least one.

(If it weren't for this, there'd be many annoyed users who ran the installer accidentally and many more hit by drive-by malware installs.)

If you are installing from an automated context (eg. your app has just downloaded an update) then you can skip straight to the installation by using the /SILENT command line parameter when running the installer.

查看更多
戒情不戒烟
3楼-- · 2019-02-14 07:09

Proper way is to disable all the pages by the following directives:

DisableWelcomePage=yes
DisableDirPage=yes
DisableProgramGroupPage=yes
DisableReadyPage=yes

But, even if you do so, the ready page will still show. I've tried to find a way how to properly skip this page and go directly to the installation step with no success. I haven't checked what's happening inside, but so far I found a workaround in posting a click notification message to the next button which triggers the click event and moves to the installation process:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
DisableWelcomePage=yes
DisableDirPage=yes
DisableProgramGroupPage=yes
DisableReadyPage=yes
[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 we are on the ready page, then... }
  if CurPageID = wpReady then
  begin
    { the result of this is 0, just to be precise... }
    Param := 0 or BN_CLICKED shl 16;
    { post the click notification message to the next button }
    PostMessage(WizardForm.NextButton.Handle, CN_COMMAND, Param, 0);
  end;
end;

That will work, but I still hope there's a cleaner way to skip all the pages and go directly to the installation process.

查看更多
登录 后发表回答