1

Is it possible to handle event when user clicks NO in uninstallation confirmation prompt?

enter image description here

And if NO is clicked, don't execute DeinitializeUninstall() ?

Or is it possible to handle NO button from DeinitializeUninstall() function?

Basically, I wont to avoid DelTree here:

procedure DeinitializeUninstall();
begin
  { if we are running in /SILENT mode, then this is an overinstall - }
  { don't delete additional folder}
  if not UninstallSilent() then
  begin
    DelTree(ExpandConstant('{#BSPLOC}'),True, True, True);
  end;
end;
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Sale
  • 48
  • 6

1 Answers1

1

I believe your logic is wrong. It looks like XY problem.

I do not think, that you want to detect "No". I believe, you want to run the code during or after uninstallation.

So use an event function that matches your requirements. The function is CurUninstallStepChanged. And depending on when you exactly need the code to run, check for a corresponding value of CurUninstallStep argument (usUninstall, usPostUninstall or usDone).

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usDone then
  begin
    { ... }
  end;
end;

For similar questions, see:


Ntb, it also seems that you abuse the /SILENT switch to detect if the uninstaller is run automatically as part of some process (upgrade?). What if the user runs the uninstaller silently him/herself? You should add another custom switch to signal the automatic run. But that's another question.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Thank you for the quick response! Removing DeinitializeUninstall() and using CurUninstallStepChanged solved the problem, Cheers! – Sale Oct 02 '17 at 08:09
  • 1
    I was actually looking how to accept the answer, but didn't noticed button for that purpose. Thanks for the clarification! – Sale Oct 02 '17 at 08:23