Inno Setup: Add a Custom Input Field

后端 未结 2 762
逝去的感伤
逝去的感伤 2021-02-04 04:53

I am making use of Inno Setup (its amazing!). I was hoping to customise the installer so that I can accept a string from the user in the form of an input field and maybe add a m

2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-04 04:56

    Here is shorter code to add a custom page to Inno Setup installer with an Input Field:

    var
      CustomQueryPage: TInputQueryWizardPage;
    
    procedure AddCustomQueryPage();
    begin
      CustomQueryPage := CreateInputQueryPage(
        wpWelcome,
        'Custom message',
        'Custom description',
        'Custom instructions');
    
      { Add items (False means it's not a password edit) }
      CustomQueryPage.Add('Custom Field:', False);
    end;
    
    procedure InitializeWizard();
    begin
      AddCustomQueryPage();
    end;
    
    procedure CurStepChanged(CurStep: TSetupStep);
    begin
      if CurStep = ssPostInstall then
      begin
        { Read custom value }
        MsgBox('Custom Value = ' + CustomQueryPage.Values[0], mbInformation, MB_OK);
      end;
    end;
    

提交回复
热议问题