How to skip all the wizard pages and go directly to the installation process?

后端 未结 2 1350
挽巷
挽巷 2020-12-18 09:38

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

相关标签:
2条回答
  • 2020-12-18 10:18

    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.

    0 讨论(0)
  • 2020-12-18 10:38

    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.

    0 讨论(0)
提交回复
热议问题