如何使用 Inno Setup 检查进程是否在 Windows 2008 R2 64 位上运行? [英] How to check with Inno Setup, if a process is running at a Windows 2008 R2 64bit?

查看:26
本文介绍了如何使用 Inno Setup 检查进程是否在 Windows 2008 R2 64 位上运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已阅读以下帖子.我的代码看起来完全一样,但不起作用:
Inno Setup 检查正在运行的进程

I've read the following post. My Code looks exactly the same, but does not work:
Inno Setup Checking for running process

我从 http://www.vincenzo.net/复制了示例isxkb/index.php?title=PSVince

但是这个例子也不起作用,即使我像这样更改代码:

But the example doesn't work either, even if I change the code like this:

[Code]
function IsModuleLoaded(modulename: AnsiString):  Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';

代码总是返回false(程序没有运行,即使它正在运行).在 Windows 2008 R2 和 Windows 7 上测试.

The code always returns false (the program is not running, even it is running). Tested at Windows 2008 R2 and Windows 7.

实际上我想检查一下,tomcat5.exe 是否正在运行.所以我想我不能使用 AppMutex.

In fact I want to check, if the tomcat5.exe is running or not. So I think I can't work with a AppMutex.

我也看到了 https://code.google.com/p/psvince/source/detail?r=5
但我找不到有关该 DLL 兼容性的任何事实.

I have also seen https://code.google.com/p/psvince/source/detail?r=5
But I can't find any facts about compatibility of that DLL.

完整代码:

[Files]
Source: psvince.dll; Flags: dontcopy

[Code]
function IsModuleLoaded(modulename: AnsiString ):  Boolean;
external 'IsModuleLoaded@files:psvince.dll stdcall';

function InitializeSetup(): Boolean;
begin
  if(IsModuleLoaded( 'notepad.exe' )) then
    begin
      MsgBox('Running', mbInformation, MB_OK);
      Result := false;
    end
  else
    begin
      MsgBox('Not running', mbInformation, MB_OK);
      Result := true;
    end
end;

推荐答案

不幸的是,根据我的观察,psvince.dll 无法查询 64 位正在运行的进程,而且由于我不是它的开发人员,我不知道如何将其修复为在 Windows x64 上工作.

Unfortunately psvince.dll cannot query 64 bit running processes based on my observation, and as I am not its developer, I don't know how to fix it to work on Windows x64.

我的解决方法是使用自制的命令行实用程序 processviewer.exe,

My workaround is to use a home-cooked command line utility, processviewer.exe,

http://github.com/lextm/processviewer

这已经在 Touch Mouse Mate

http://www.lextm.com/2012/03/new-inno-setup-installer-script-samples-version-compare-running-processes/

这篇关于如何使用 Inno Setup 检查进程是否在 Windows 2008 R2 64 位上运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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