wassup
wassup

Reputation: 2511

Uninstaller checking if a task was selected during the installation

How would one check, at the time of uninstalling, if a task checkbox was selected during the installation, using Inno Setup?

Upvotes: 1

Views: 683

Answers (1)

TLama
TLama

Reputation: 76753

You can use the IsTaskSelected function if you're writing a Check function for some uninstaller section entry. The IsTaskSelected function cannot be called at uninstaller runtime, but you can use it there because the Check parameter values for uninstall sections are evaluated when the installer creates the uninstall log at the end of the installation. So you can do this:

[Tasks]
Name: mytask; Description: "Task"; GroupDescription: "Tasks"

[UninstallRun]
...; Check: IsTaskSelected('mytask')

[UninstallDelete]
...; Check: IsTaskSelected('mytask')

But you cannot call it at uninstaller runtime, so this will fail to execute:

procedure InitializeUninstallProgressForm;
begin
  if IsTaskSelected('mytask') then // <- this will fail to execute
    ...
end;

To determine the task state at uninstaller runtime you can query the Inno Setup: Selected Tasks registry value as was mentioned in comments.

Upvotes: 2

Related Questions