Nico Z
Nico Z

Reputation: 1027

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

I am using this code Custom Uninstall page (not MsgBox). (See the answer of Fr0sT). I want to disable the original uninstalling page by a new inside the custom uninstall page. Is this possible?

Upvotes: 0

Views: 2330

Answers (1)

Martin Prikryl
Martin Prikryl

Reputation: 202118

First, I believe it would be better to modify the standard uninstall form, rather than trying to implement a new one from the scratch.

See my answer to Custom Uninstall page (not MsgBox).


Anyway, to answer your question. Yes, with some effort this may be possible.

To hide the main window and display a custom one, do:

[Code]

var
  CustomUninstallForm: TSetupForm;

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then
  begin
    UninstallProgressForm.Visible := False;
    { Move the hidden form back to the screen }
    { in a hope that eventual error messages will appear on screen }
    UninstallProgressForm.Left := CustomUninstallForm.Left;
    UninstallProgressForm.Top := CustomUninstallForm.Top;
  end;
end;

procedure InitializeUninstallProgressForm();
begin
  { Move the form away, so that it does not briefly flash on the window before the }
  { CurUninstallStepChanged(usUninstall) is called }
  UninstallProgressForm.Left := -1000;
  UninstallProgressForm.Top := -1000;

  { Create a custom form and display it }
  CustomUninstallForm := CreateCustomForm;
  CustomUninstallForm.SetBounds(
    0, 0, UninstallProgressForm.Width, UninstallProgressForm.Height);
  CustomUninstallForm.Position := poScreenCenter;  
  CustomUninstallForm.Show;
end;

Upvotes: 1

Related Questions