Installation Inno设置:选择更新或删除/卸载的自定义页面

Installation Inno设置:选择更新或删除/卸载的自定义页面,installation,inno-setup,Installation,Inno Setup,我需要创建一个自定义卸载页面,让用户选择是要更新软件还是卸载软件(如果软件已经安装) 我已经完成了自定义页面,如下所示: 当用户单击“下一步”按钮时,如何获取这些单选按钮的值? 我如何更新或卸载程序 更新: procedure InitializeWizard(); var InstallPath: String; BackgroundBitmapImage: TBitmapImage; BmpFileName : String; Temp : String;

我需要创建一个自定义卸载页面,让用户选择是要更新软件还是卸载软件(如果软件已经安装)

我已经完成了自定义页面,如下所示:

当用户单击“下一步”按钮时,如何获取这些单选按钮的值? 我如何更新或卸载程序

更新:

procedure InitializeWizard();
var
  InstallPath: String;
  BackgroundBitmapImage: TBitmapImage;
  BmpFileName : String;
  Temp        : String;
  AppId       : String;
  Color       : String;
begin
  AppId:=ExpandConstant('{#AppId}');
  if(AppIsInstalled(AppId, InstallPath)) Then
  begin
      UpdateRemovePageID := RepairRemove_CreatePage(wpWelcome);
  end;

  BmpFileName:= ExpandConstant('{src}\Background.bmp');
  if FileExists(BmpFileName) then begin     
      BackgroundBitmapImage := TBitmapImage.Create(MainForm);         
      BackgroundBitmapImage.Align := alClient;
      BackgroundBitmapImage.Autosize := True;
      BackgroundBitmapImage.Center := True;      
      BackgroundBitmapImage.Bitmap.LoadFromFile(BmpFileName);
  end;  
  BackgroundBitmapImage.BackColor := StringToColor('8cceff');
  BackgroundBitmapImage.Parent  := MainForm;
  WizardForm.Caption := MainForm.Caption;

  if(FileExists(ExpandConstant('{src}\WizImage.bmp'))) then begin


  WizardForm.WizardBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{src}') + '\WizImage.bmp');
  end  
  if(FileExists(ExpandConstant('{src}\WizSmallImage.bmp'))) then begin
      WizardForm.WizardSmallBitmapImage.Bitmap.LoadFromFile(ExpandConstant('{src}') + '\WizSmallImage.bmp');
  end 
end;

function RepairRemove_CreatePage(PreviousPageId: Integer): Integer;
var
    Page: TWizardPage;
    UpdateBmpFileName : String;
    RemoveBmpFileName : String;
begin
    Page := CreateCustomPage(PreviousPageId, ExpandConstant('{cm:RepairRemove_Caption}'), ExpandConstant('{cm:RepairRemove_Description}'));

    BitmapImageUpdate := TBitmapImage.Create(Page);
    UpdateBmpFileName := ExpandConstant('{tmp}\Update.bmp');
    if not FileExists(UpdateBmpFileName) then begin
        ExtractTemporaryFile(ExtractFileName(UpdateBmpFileName));
    end;
    BitmapImageUpdate.Bitmap.LoadFromFile(UpdateBmpFileName);

    with BitmapImageUpdate do
    begin
        Parent := Page.Surface;
        Left := ScaleX(64);
        Top := ScaleY(64);
        Width := ScaleX(32);
        Height := ScaleY(32);
    end;

    Label1 := TLabel.Create(Page);
    with Label1 do
    begin
        Parent := Page.Surface;
        Caption := ExpandConstant('{cm:RepairRemove_Label1_Caption0}');
        Left := ScaleX(120);
        Top := ScaleY(72);
        Width := ScaleX(243);
        Height := ScaleY(13);
    end;

    BitmapImageRemove := TBitmapImage.Create(Page);
    RemoveBmpFileName := ExpandConstant('{tmp}\TrashCan.bmp');
    if not FileExists(RemoveBmpFileName) then begin
        ExtractTemporaryFile(ExtractFileName(RemoveBmpFileName));
    end;
    BitmapImageRemove.Bitmap.LoadFromFile(RemoveBmpFileName);

    with BitmapImageRemove do
    begin
        Parent := Page.Surface;
        Left := ScaleX(64);
        Top := ScaleY(120);
        Width := ScaleX(32);
        Height := ScaleY(32);
    end;

    Label2 := TLabel.Create(Page);
    with Label2 do
    begin
        Parent := Page.Surface;
        Caption := ExpandConstant('{cm:RepairRemove_Label2_Caption0}');
        Left := ScaleX(120);
        Top := ScaleY(128);
        Width := ScaleX(243);
        Height := ScaleY(13);
    end;

    UpdateButton := TRadioButton.Create(Page);
    with UpdateButton do
    begin
        Parent := Page.Surface;
        Caption := ExpandConstant('');
        Left := ScaleX(32);
        Top := ScaleY(72);
        Width := ScaleX(17);
        Height := ScaleY(17);
        TabOrder := 0;
    end;

    RemoveButton := TRadioButton.Create(Page);
    with RemoveButton do
    begin
        Parent := Page.Surface;
        Caption := ExpandConstant('');
        Left := ScaleX(32);
        Top := ScaleY(128);
        Width := ScaleX(17);
        Height := ScaleY(17);
        Checked := True;
        TabOrder := 1;
        TabStop := True;
    end;

    with Page do
    begin
        OnActivate := @RepairRemove_Activate;
        OnShouldSkipPage := @RepairRemove_ShouldSkipPage;
        OnBackButtonClick := @RepairRemove_BackButtonClick;
        OnNextButtonClick := @RepairRemove_NextButtonClick;
        OnCancelButtonClick := @RepairRemove_CancelButtonClick;
    end;

    Result := Page.ID;
end;
function RepairRemove_NextButtonClick(Page: TWizardPage): Boolean;
begin
    Result := True;
//What I have to do here to correctly handle the user choice?
end;
如何更新或卸载程序

  • 更新-默认情况下安装程序就是这样做的

  • 卸载-请参阅

    您还需要在卸载后中止安装程序:

function RepairRemove\u NextButtonClick(第页:TWizardPage):布尔值;
开始
如果移除按钮,则选中
开始
{在这里卸载}
{和中止安装程序}
出境手续(1);
结束;
结果:=真;
结束;

可能与我更改的问题重复。现在有点不同了。“获取这些单选按钮的值”-这意味着什么?@MartinPrikryl获取用户选择的单选按钮
TNewRadioButton。选中