简体   繁体   中英

Inno Setup: Cannot call “WIZARDISCOMPONENTSELECTED” function during Uninstall

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM