Inno Setup:尝试卸载时检测安装程序是否为 运行

Inno Setup : Detect if the Setup is running when trying to Uninstall

您好,我希望我的 Inno 安装脚本在尝试使用 unins000.exe.[= 卸载我的程序之前检测我的程序的安装程序是否为 运行 17=]

如果当用户尝试卸载我的程序时我的程序的安装程序已经 运行,卸载程序应该通过弹出一个消息框警告用户 Setup is running. Please install using it before uninstalling. Really want to Continue? 和两个按钮 YesNo.

如何在没有任何不稳定的情况下执行此操作?

感谢您的帮助。

无法彻底中止安装。我不会试图杀死它。让它结束。

[Setup]
SetupMutex=MySetupsMutexName

[Code]

function InitializeUninstall(): Boolean;
begin
  while CheckForMutexes('MySetupsMutexName') then
  begin
    MsgBox('Installer is still running', mbError, MB_OK);
  end;
end;