Inno Setup检查运行过程 [英] Inno Setup Checking for running process

查看:139
本文介绍了Inno Setup检查运行过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Inno Setup项目,我想在卸载该应用程序之前检查它是否正在实际运行.我尝试了许多方法,但是在Windows 7中运行时,所有操作均会以静默方式失败.例如,以下脚本使用psvince.dll检查notepad.exe进程始终返回false,而不管记事本是否在运行.

I have a Inno Setup project that I want to check if the application is actually running before uninstalling it. I tried many ways but it all fails silently, when running in Windows 7. For example the following script that checks for notepad.exe process using psvince.dll always returns false regardless of Notepad being running or not.

我在C#应用程序中使用了psvince.dll来检查它是否可以在Windows 7下运行,并且可以正常工作.因此,我最好的猜测是启用UAC的安装程序无法正确运行.

I used psvince.dll in a C# app to check, if it works under Windows 7 and it works without any problem. So my best guess is that installer can not run correctly with UAC enabled.

[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;

推荐答案

您是否正在使用Unicode Inno Setup?如果是的话,应该说

Are you using Unicode Inno Setup? If you are, it should say

function IsModuleLoaded(modulename: AnsiString): Boolean;

因为psvince.dll不是Unicode dll.

since psvince.dll isn't a Unicode dll.

该示例还将检查epub.exe,而不是notepad.exe.

Also the example checks for epub.exe, not notepad.exe.

这篇关于Inno Setup检查运行过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆