inno-setup - 在 Inno Setup 中禁用静默和非常静默卸载

标签 inno-setup

是否可以在 Inno Setup 中禁用静默和非常静默卸载?

最佳答案

您无法直接禁用它,但您可以检查它是否以静默模式运行,并在 InitializeSetup()/InitialiseUninstall() 期间显示消息/退出事件函数。

function InitializeSetup(): Boolean;
begin
  // Default to OK
  result := true;

  // If it's in silent mode, exit
  if WizardSilent() then
  begin
    MsgBox('This setup doesn''t support silent installations.', mbInformation, MB_OK);
    result := false;
  end;
end;

或者卸载:

function InitializeUninstall(): Boolean;
begin
  // Default to OK
  result := true;

  // If it's in silent mode, exit
  if UninstallSilent() then
  begin
    MsgBox('This setup doesn''t support silent uninstallation.', mbInformation, MB_OK);
    result := false;
  end;
end;

(未经测试的空中代码)

如果您想在非静默模式下静默 (??? :o) 重新运行安装程序,您可以在 InitializeSetup if block 中使用它:

ShellExecAsOriginalUser('', ExpandConstant('{srcexe}'), '', '',  SW_SHOWNORMAL, ewNoWait, 0);

请注意,这也会删除传递的任何其他参数并再次提示提升。

关于inno-setup - 在 Inno Setup 中禁用静默和非常静默卸载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10815873/

相关文章:

inno-setup - Inno Setup 编译器可以在 Exec() 预处理器功能失败时停止吗?

c++ - 卸载基于 Inno 的设置时从用户配置文件中删除文件

inno-setup - 如何在 Inno Setup Preprocessor 中大写字符串?

windows-installer - 使用 Inno Setup 有条件地安装 x64 驱动程序

loops - Inno Setup 在 Pascal 代码中迭代 [Files] 部分

inno-setup - 在 Inno Setup 中复制隐藏文件

inno-setup - 如何在基于Inno Setup的安装程序中创建自己的表单或页面?

inno-setup - 如何隐藏主面板并在整个页面上显示图像?

installation - Inno Setup - 没有 64 位数据类型?

c# - 如何在 Inno Setup 中使用数据库为 .NET 应用程序制作安装文件?