0

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?

Community
  • 1
  • 1
Nico Z
  • 997
  • 10
  • 33

1 Answers1

1

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;

Community
  • 1
  • 1
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • First, thank you for answering my question. But, It's not what i asked. Is your answer to http://stackoverflow.com/questions/7415457/custom-uninstall-page-not-msgbox#42550055 – Nico Z Mar 02 '17 at 11:36
  • How come it's not what you have asked? So what did you ask? What is my answer missing? – Martin Prikryl Mar 02 '17 at 12:02
  • I want to hide the original uninstall page and add a custom uninstall page, all from the Fr0sT code. – Nico Z Mar 03 '17 at 11:34
  • Sorry, I do not understand. There's no uninstall page in the Fr0sT code. There are just some custom pages. The video you have posted shows exactly [what my code](http://stackoverflow.com/q/7415457/850848#42550055) implements. So what's wrong? – Martin Prikryl Mar 03 '17 at 11:38
  • It seems that you have [XY problem](http://meta.stackexchange.com/q/66377/218578). You want X (wizard-style **uninstall** form), you have picked Y (Fr0sT implementation of wizard-style **custom** form) as a bad way to achieve the X. I've shown you that, while using the Y to achieve the X is possible, it's a wrong way. And you should use Z instead (my code). – Martin Prikryl Mar 03 '17 at 11:40
  • If you read the comments to the Fr0sT answer, you will see that he claims that Z is not possible, that's why he implemented the Y. Not because it's a good way, but because he could not find a way to implement Z (but I've shown that it's possible). – Martin Prikryl Mar 03 '17 at 11:42
  • I asked about the posibility of hide the original uninstalling page and add custom uninstalling page to this code. Perhaps the acceptable answer to me is that can not do such a thing and i can do something better with your code? (Sorry bad english) http://stackoverflow.com/q/7415457/850848#42550055 (your answer) – Nico Z Mar 03 '17 at 13:14
  • Why do you want to hide the original form (it's not a page) and re-implement it? What is wrong with the original form? What functionality do you want to implement, that the original form prevents you from implementing? You still didn't explain this - So far you didn't ask for anything, that would be easier to implement using a separate form, rather than by modifying the original form - Actually quite on the contrary - Re-implementing the uninstall form from the scratch, while retaining all the functionality (particularly error handling), is nearly impossible. – Martin Prikryl Mar 03 '17 at 13:20
  • Is it clear now? Is there anything you need to add to my answer? – Martin Prikryl Mar 03 '17 at 13:26