-1

What would cause the message:

Cannot call "WIZARDISCOMPONENTSELECTED" function during Uninstall.

It has to be here:

procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
  if CurUninstallStep = usUninstall then
  begin
    if WizardIsComponentSelected('mycomponent') then
    begin
      DoSomething(False);
    end;
  end;
end;

How do you determine if the component was selected at uninstall time? It has to undo some stuff before uninstalled. Typically Inno Setup has ways to get if something was installed or not.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
df234987
  • 513
  • 2
  • 13
  • 1
    The error is pretty clear. The `WizardIsComponentSelected` isn't supported at Uninstall. Searching found this question ([Inno Setup Uninstall some components only](https://stackoverflow.com/questions/37507369/inno-setup-uninstall-some-components-only)) that says partial uninstalls are not supported. You might be able to check for something else to see if the component was installed like a registry entry or binary existence and then call your "DoSomething" function. – mirtheil Jun 06 '20 at 01:35
  • The error message is pretty clear and unambiguous. Did you actually read the words in it? *You cannot call this function during uninstall* seems pretty specific and self-explanatory. – Ken White Jun 06 '20 at 01:53

1 Answers1

0

There's no API in Pascal Script to tell in the uninstaller, what tasks were selected when installing. Probably because, there might have been multiple installations, each with different set of tasks. So it would be questionable, what set of tasks the API should report.

What you should (and need) to do is to check the effect of the task. Like checking if a specific file or a specific Registry key exists.


Though note that Tasks parameters still work in the uninstaller sections [UninstallDelete] and [UninstallRun]. So you can make use of them.


See also Inno Setup Uninstall some components only

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992