IE - How to detect Internet Explorer version installed

From ISXKB

Jump to: navigation, search

This script is useful to detect if, and which version of IE Internet Explorer is installed on the machine.

See also MSKB 164539: How to determine which version of Internet Explorer is installed

[Setup]
AppName=IEVersion
AppVerName=IEVersion
DefaultDirName=IEVersion
DisableStartupPrompt=true
Uninstallable=false
CreateAppDir=false

[Code]

function GetIExplorerVersion(): String;
var
  sVersion:  String;
begin
  RegQueryStringValue( HKLM, 'SOFTWARE\Microsoft\Internet Explorer', 'Version', sVersion );
  Result := sVersion;
end;


function InitializeSetup(): Boolean;
begin
  MsgBox( 'Version of Internet Explorer is (' + GetIExplorerVersion() + ')',
  	mbInformation, MB_OK );
  Result := false;
end;


Another method

Does you installer require a min version of IE to be present on the sys? If so the below may be of use.

The CompareVersion() function comes from MDAC - How to detect version of MDAC installed

function InitializeSetup(): Boolean;
begin

.
.
.

  if not IsIeDetected('6') then begin
    //Inform user, install IE etc
  end;

.
.
.
  Result := true;
end;

function IsIeDetected(ieVerNeeded: String): boolean;
var
    irver: String;
    vercomp: Integer;
begin
    RegQueryStringValue(HKLM, 'Software\Microsoft\Internet Explorer', 'Version', irver);

    //Was there any data returned?
    if Length( irver ) > 0 then
    begin
      //Compare versions
      vercomp := CompareVersion(irver, ieVerNeeded);

      //Version smaller
      if vercomp < 0 then
      begin
        Result := false;
      end;

      //Same version
      if vercomp = 0 then
      begin
        Result := true;
      end;

      //Version bigger
      if vercomp > 0 then
      begin
        Result := true;
      end;
    end
    else
    begin
      Result := false;
    end;
end;
Personal tools
Ads: