3

ユーザーがすでに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が既にインストールされているかどうかを判断するために確認できるレジストリキーのようなものはありますか?
どんな助けでも大歓迎です。

4

3 に答える 3

4

RishiはRaiseException2つのパラメーターを持つ関数を使用していますが、この関数は1つしかサポートしていません。

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;
于 2010-11-18T23:19:00.760 に答える
2

IISは常に%windir%\ system32 \ inetsrvにインストールされるため、このディレクトリの下に特定のファイルが存在するかどうかを確認する必要があります。たとえば、IIS 6/7の場合、w3wp.exeはこのフォルダに存在する必要があります。

于 2010-11-19T14:29:04.197 に答える
2

試す:

[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

;

于 2011-01-23T23:01:27.247 に答える