Search code examples
delphiiisinno-setuppascalscript

How to detect an existing installation of IIS using INNO setup?


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.


Solution

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