【发布时间】:2019-08-27 19:35:23
【问题描述】:
我有一个 Inno Setup 项目,我想在卸载它之前检查应用程序是否实际运行。我尝试了很多方法,但在 Windows 7 中运行时,它们都以静默方式失败。例如,使用psvince.dll 检查notepad.exe 进程的以下脚本始终返回false,无论记事本是否正在运行。
我在 C# 应用程序中使用psvince.dll 来检查它是否在 Windows 7 下工作并且没有任何问题。所以我最好的猜测是安装程序无法在启用 UAC 的情况下正确运行。
[Code]
function IsModuleLoaded(modulename: String): Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';
function InitializeSetup(): Boolean;
begin
if(Not IsModuleLoaded('ePub.exe')) then
begin
MsgBox('Application is not running.', mbInformation, MB_OK);
Result := true;
end
else
begin
MsgBox('Application is already running. Close it before uninstalling.', mbInformation, MB_OK);
Result := false;
end
end;
【问题讨论】:
-
我有同样的问题,但 AnsiString 没有帮助我。
标签: inno-setup