我在自定义 UninstallProgressForm
( Custom Uninstall page (not MsgBox) ) 中使用此代码来定义卸载后的消息(没有原始卸载程序消息):
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
case CurUninstallStep of
usPostUninstall:
if not WizardVerySilent and UninstallSilent then begin
MsgBox(CustomMessage('UninstallComplete'), mbInformation, MB_OK);
end;
end;
end;
我想在卸载以前的版本(如果存在)时的某个特定时刻隐藏此消息。为了卸载以前的版本,我使用以下代码:How to detect old installation and offer removal? 。我已经用此代码修改了上一个链接的代码,以运行卸载程序(如果有以前的版本):Executing UninstallString in Inno Setup
最佳答案
当您执行卸载以前的版本时,向卸载程序添加自定义开关。就像/UPDATE
:
Exec(UninstallPath, UninstallParams + ' /UPDATE', '', SW_SHOW,
wWaitUntilTerminated, iResultCode)
然后检查开关:
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
case CurUninstallStep of
usPostUninstall:
if UninstallSilent and (not WizardVerySilent) and
(not CmdLineParamExists('/UPDATE')) then
begin
MsgBox(CustomMessage('UninstallComplete'), mbInformation, MB_OK);
end;
end;
end;
CmdLineParamExists
函数来自Passing conditional parameter in Inno Setup .
关于inno-setup - Inno Setup - 检测另一个进程何时为特定任务自动运行(卸载)安装程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47078888/