卸载程序检查安装期间是否选择了任务

Uninstaller checking if a task was selected during the installation

如何在卸载时使用 Inno Setup 检查是否在安装过程中选中了任务复选框?

当安装程序在安装结束时创建卸载日志时,您可以使用 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 评估卸载部分的参数值。所以你可以这样做:

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

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

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

但是你不能在卸载程序运行时调用它,所以这将无法执行:

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

要确定卸载程序运行时的任务状态,您可以查询评论中提到的 Inno Setup: Selected Tasks 注册表值。