Q:

Running an application at the end of the uninstall in InnoSetup, handling the user cancelling

During un-installation, user will be asked "Are you sure to uninstall ...".
Then the user will click either "Yes" or "No".
Is it possible to catch this on the script?
Because I need to execute an application at the end of uninstallation process.
If I execute the application during "InitializeUninstall()", that is not correct because the user could cancel the uninstallation later (the above dialog is displayed AFTER this function).
Same with "DeInitializeUninstall()", this function is still executed even the user cancel the uninstallation.
Basically, I need to execute the application when the user is really un-installing (agreed to uninstall). Because I need to catch the ExitCode of this application to set the UninstallNeedRestart() function.
Thanks. 

A:

What you can do is add a global variable in your [Code] section
 [Code]

var
  ApplicationWasUninstalled: Boolean;

After that, in the InitializeUninstallProgressForm procedure you can set the global variable to 1 (Note: this function gets executed only if the user clicks Yes when they are prompted if they want to uninstall your application
procedure InitializeUninstallProgressForm();
begin
  ApplicationWasUninstalled := true;
end;

Moving on, you will check the value of ApplicationWasUninstalled  in DeinitializeUninstall function
procedure DeinitializeUninstall();
begin
  if ApplicationWasUninstalled Then Begin
      //your code here
  end;
end;

