Inno Setup: Custom page to select Update or Remove/Uninstall

KingOfMazes

I need to create a custom uninstall page that let the user choose if he wants to update the software or uninstall it (if the software is already installed).

I have already done my custom page and is like this: enter image description here

How can I get the values of those radio buttons when the user click the Next Button? And, how can I update or uninstall the program?

UPDATE:

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;
Martin Prikryl

how can I update or uninstall the program?

function RepairRemove_NextButtonClick(Page: TWizardPage): Boolean;
begin
  if RemoveButton.Checked then
  begin
    { Uninstall here }

    { And abort installer }
    ExitProcess(1);
  end;

  Result := True;
end;

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Custom Page Wizard of Inno Setup

From Dev

Custom Page Wizard of Inno Setup

From Dev

Inno Setup Custom Page with Google Map

From Dev

Inno Setup: Ready Page custom layout

From Dev

Inno Setup Custom Page with Google Map

From Dev

Larger "Select Components" page in Inno Setup

From Dev

Inno Setup - How to create a new uninstalling page in a custom uninstall page?

From Dev

Inno Setup: Custom classes

From Dev

Inno Setup: Custom classes

From Dev

Inno setup page order

From Dev

Automatic update of Inno Setup program

From Dev

Inno Setup Custom URL for Chrome

From Dev

how to refresh a page in inno setup

From Dev

Inno Setup: Disable finish page

From Dev

Inno Setup: Function to select a component

From Dev

Inno Setup "Setup Completed" wizard page

From Dev

Inno Setup "Setup Completed" wizard page

From Dev

Restore previously entered data on custom page next time Inno Setup-made installer is executed

From Dev

Inno Setup generated installer does not show "Select Destination Location" page on some systems

From Dev

Inno Setup Skip "Select Components" page when /Type command-line parameter is specified

From Dev

In Inno Setup, can I add a note (static text) to the Select Tasks page?

From Dev

Should Inno Setup delete old files on Update?

From Dev

Inno Setup – zip local files prior to an update

From Dev

Should Inno Setup delete old files on Update?

From Java

Prechecked or unchecked components in Inno Setup custom install

From Dev

Using custom DLL with Inno-Setup

From Dev

How to add two custom pages in Inno Setup?

From Dev

Inno Setup - Create custom message box (yes / no)

From Dev

Inno Setup replace buttons at wpFinished page

Related Related

HotTag

Archive