Get Internet Explorer Version

With more and more applications becoming reliant on the functionality of Internet Explorer, you often need to check version numbers to ensure certain features are supported.

For example, if you’re using auto-complete in your application, you'll need to ensure your user has Internet Explorer 5 or greater. If you don’t check and dive straight into the deep end, you’re in for trouble.

Another example is DCOM, which seems to require at least Internet Explorer 4 to function correctly.

These two functions should be able to solve your problems. To retrieve the major version numbers of Internet Explorer, simply call IEVersion. It will return a number, such as '5' for Internet Explorer 5.

The IEVersionString function returns a string with the browser name, major version number, plus both minor and build figures. An example of this could be "Internet Explorer 5.0.2314", useful for System Information dialog boxes.

Usage

MsgBox IEVersion
MsgBox IEVersionString

Code

Private Type DllVersionInfo
   cbSize As Long
   dwMajorVersion As Long
   dwMinorVersion As Long
   dwBuildNumber As Long
   dwPlatformID As Long
End Type

Private Declare Function DllGetVersion _
   Lib "Shlwapi.dll" _
  (dwVersion As DllVersionInfo) As Long

Public Function IEVersion() As Long

    Dim VersionInfo As DllVersionInfo
    VersionInfo.cbSize = Len(VersionInfo)
    
    Call DllGetVersion(VersionInfo)
    
    IEVersion = VersionInfo.dwMajorVersion

End Function

Public Function IEVersionString()

    Dim VersionInfo As DllVersionInfo
    VersionInfo.cbSize = Len(VersionInfo)
    
    Call DllGetVersion(VersionInfo)
    
    IEVersionString = "Internet Explorer " & _
        VersionInfo.dwMajorVersion & "." & _
        VersionInfo.dwMinorVersion & "." & _
        VersionInfo.dwBuildNumber

End Function


Cheap Phone Systems | Arcade Games | Jewelry Directory | Discount Window Shades | Auto Insurance Quotes