如何使用 INNO 安装程序检测现有的 IIS 安装?

发布于 2024-10-03 09:53:39 字数 510 浏览 1 评论 0原文

我正在寻找一种方法来确定用户是否已经安装了 IIS 版本。如果他不这样做,我将继续运行我的 IIS 安装脚本。

我知道我所做的异常处理子句:

  try
    IIS := CreateOleObject('IISNamespace');  
  except  
    RaiseException(ExceptionType, ‘IIS not installed. Setup will now install IIS on your machine. ’#13#13'(Error ‘’’+ExceptionParam+’’’ occured)’);  
  end;

但由于某种原因,我的编译器版本似乎无法识别 RaiseException。我也尝试过包含

uses  
SysUtils;  

,但编译器甚至无法识别 SysUtils。是否有类似注册表项之类的东西,我可以通过查看来确定 IIS 是否已安装?
任何帮助将不胜感激。

I am looking for a way to determine if the user already has a version of IIS installed. If he doesn't, I will go ahead and run my IIS installation script.

I know of the exception handling clause where I do :

  try
    IIS := CreateOleObject('IISNamespace');  
  except  
    RaiseException(ExceptionType, ‘IIS not installed. Setup will now install IIS on your machine. ’#13#13'(Error ‘’’+ExceptionParam+’’’ occured)’);  
  end;

but for some reason, my compiler version doesn't seem to recognise RaiseException. I also tried including

uses  
SysUtils;  

but the compiler won't recognize SysUtils even. Is there something like a registry key that I can look at to determine whether IIS is already installed or not?
Any help would be much appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

甜心 2024-10-10 09:53:39

Rishi 您正在使用带有 2 个参数的 RaiseException 函数,但该函数仅支持一个。

procedure RaiseException(const Msg: String);

尝试像这样使用这个函数

var
 IIS : variant;
begin    
  try
    IIS := CreateOleObject('IISNamespace');
  except
    RaiseException('IIS not installed. Setup will now install IIS on your machine');
  end;
end;

Rishi you are using the RaiseException function with 2 parameters, but the this function only support one.

procedure RaiseException(const Msg: String);

try using this function like this

var
 IIS : variant;
begin    
  try
    IIS := CreateOleObject('IISNamespace');
  except
    RaiseException('IIS not installed. Setup will now install IIS on your machine');
  end;
end;
末が日狂欢 2024-10-10 09:53:39

IIS 始终安装到 %windir%\system32\inetsrv,因此您应该检查此目录下是否存在特定文件。例如,对于 IIS 6/7,w3wp.exe 应存在于该文件夹中。

IIS always installs to %windir%\system32\inetsrv so you should check if specific files exist under this directory. For example, w3wp.exe should exist in this folder for IIS 6/7.

救星 2024-10-10 09:53:39

尝试:

[CustomMessages]
iis_title=Internet Information Services (IIS)


[Code]
function iis(): boolean;
begin
    if not RegKeyExists(HKLM, 'SYSTEM\CurrentControlSet\Services\W3SVC\Security') then
        MsgBox(FmtMessage(CustomMessage('depinstall_missing'), [CustomMessage('iis_title')]), mbError, MB_OK)
    else
        Result := true;
end

;

Try:

[CustomMessages]
iis_title=Internet Information Services (IIS)


[Code]
function iis(): boolean;
begin
    if not RegKeyExists(HKLM, 'SYSTEM\CurrentControlSet\Services\W3SVC\Security') then
        MsgBox(FmtMessage(CustomMessage('depinstall_missing'), [CustomMessage('iis_title')]), mbError, MB_OK)
    else
        Result := true;
end

;

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文