[Setup] AppName=My Program AppVersion=1.5 DefaultDirName={pf}\My Program AlwaysRestart=no DisableFinishedPage=yes [CustomMessages] restart_Caption0=Yes restart now restart_Caption1=No restart later [Code] var RestartRadioButton: TRadioButton; PostponeRestartRadioButton: TRadioButton; Page: TWizardPage; FirstLabel: TLabel; FirstLabelB: TLabel; LabelText: string; LabelTextB: string; function NeedRestart(): Boolean; begin Result := True; end; function authentication_form_NextButtonClick(Page: TWizardPage): Boolean; begin if PostponeRestartRadioButton.Checked then begin MsgBox('The computer needs to be restarted before Setup can continue.', mbError, MB_OK); RestartRadioButton.Checked := True Result := False; end else begin NeedRestart(); Result := True; end end; function CreateDataPage(PreviousPageId: Integer): Integer; begin if (FileExists('C:\Windows\System32\bash.exe')) then begin LabelText := 'WSL is already installed.' end else begin LabelText := 'WSL was installed.' end; LabelTextB := 'The computer needs to be restarted before Setup can continue.' Page :=CreateCustomPage(PreviousPageId,'WSL installation', ''); FirstLabel :=TLabel.Create(Page); with FirstLabel do begin Parent :=Page.Surface; Caption :=ExpandConstant(LabelText); Left :=ScaleX(16); Top :=ScaleY(50); Width :=ScaleX(250); Height :=ScaleY(17); end; FirstLabelB :=TLabel.Create(Page); with FirstLabelB do begin Parent :=Page.Surface; Caption :=ExpandConstant(LabelTextB); Left :=ScaleX(16); Top :=ScaleY(84); Width :=ScaleX(500); Height :=ScaleY(17); end; RestartRadioButton := TRadioButton.Create(Page); with RestartRadioButton do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:restart_Caption0}'); Left := ScaleX(16); Top := ScaleY(112); Width := ScaleX(193); Height := ScaleY(17); TabOrder := 2; Checked := true; end; PostponeRestartRadioButton := TRadioButton.Create(Page); with PostponeRestartRadioButton do begin Parent := Page.Surface; Caption := ExpandConstant('{cm:restart_Caption1}'); Left := ScaleX(16); Top := ScaleY(140); Width := ScaleX(193); Height := ScaleY(17); TabOrder := 2; end; with Page do begin OnNextButtonClick := @authentication_form_NextButtonClick; if PostponeRestartRadioButton.Checked then begin RestartRadioButton.Checked := false end; if RestartRadioButton.Checked then begin PostponeRestartRadioButton.Checked := false end; end; Result :=Page.ID; end; procedure InitializeWizard(); begin CreateDataPage(wpInstalling); end; procedure CurPageChanged(CurPageID: Integer); begin if CurPageID = Page.ID then begin WizardForm.NextButton.Caption := 'Finish' end; end;