安装时调用 UninstallDelete 检查函数
Check function for UninstallDelete is called upon installation
我正在使用 Inno Setup 制作我的(卸载)安装程序。我想在卸载后选择性地删除一些 "leftover" 文件,因此我使用 [UninstallDelete]
部分和 Check
功能。函数 returns 一些值,但也显示一些调试信息。像这样:
[UninstallDelete]
Type: filesandordirs; Name: "{app}\Plugins"; Check: ShouldRemovePlugins
[Code]
//...
var
DelPlugins: Boolean;
//...
function ShouldRemovePlugins(): Boolean;
var text:string;
begin
if(DelPlugins = true) then
text := 'We should remove plugins'
else
text := 'We should not remove plugins';
MsgBox(text, mbInformation, MB_OK);
Result := DelPlugins;
end;
事实是,根据弹出的消息框,安装时以某种方式调用了函数,而不是卸载。所以,问题是——为什么会这样?是关于 Inno Setup "workflow" 的吗?
在安装过程中确定卸载时将执行哪些卸载任务(包括但不限于 UninstallDelete
个条目)。
因此您的 Check
函数确实会在安装期间被调用。
查看 UninstallDelete
部分的处理方式 a step of installation:
Once the actual installation process begins, this is the order in which the various installation tasks are performed:
[InstallDelete]
is processed.
- The entries in
[UninstallDelete]
are stored in the uninstall log (which, at this stage, is stored in memory).
- The application directory is created, if necessary.
- ...
要在卸载期间有条件地删除文件,您必须在 CurUninstallStepChanged
event function.
中明确编码
使用 usUninstall
或 usPostUninstall
步骤。
我正在使用 Inno Setup 制作我的(卸载)安装程序。我想在卸载后选择性地删除一些 "leftover" 文件,因此我使用 [UninstallDelete]
部分和 Check
功能。函数 returns 一些值,但也显示一些调试信息。像这样:
[UninstallDelete]
Type: filesandordirs; Name: "{app}\Plugins"; Check: ShouldRemovePlugins
[Code]
//...
var
DelPlugins: Boolean;
//...
function ShouldRemovePlugins(): Boolean;
var text:string;
begin
if(DelPlugins = true) then
text := 'We should remove plugins'
else
text := 'We should not remove plugins';
MsgBox(text, mbInformation, MB_OK);
Result := DelPlugins;
end;
事实是,根据弹出的消息框,安装时以某种方式调用了函数,而不是卸载。所以,问题是——为什么会这样?是关于 Inno Setup "workflow" 的吗?
在安装过程中确定卸载时将执行哪些卸载任务(包括但不限于 UninstallDelete
个条目)。
因此您的 Check
函数确实会在安装期间被调用。
查看 UninstallDelete
部分的处理方式 a step of installation:
Once the actual installation process begins, this is the order in which the various installation tasks are performed:
[InstallDelete]
is processed.- The entries in
[UninstallDelete]
are stored in the uninstall log (which, at this stage, is stored in memory).- The application directory is created, if necessary.
- ...
要在卸载期间有条件地删除文件,您必须在 CurUninstallStepChanged
event function.
使用 usUninstall
或 usPostUninstall
步骤。