确定本地计算机上安装的 Internet Explorer 的版本






4.97/5 (11投票s)
2001年11月18日
8分钟阅读

232080
两种以编程方式确定本地计算机上安装的 Internet Explorer 版本的方法。
引言
迄今为止,微软总共发布了六个主要版本的 Internet Explorer 浏览器。但鲜为人知的是,实际上有三十六个不同的 Internet Explorer 次要版本。通过编程方式识别它们可能是一个真正的难题,尤其是对于早期版本。
首先,微软内部使用的版本号与我们消费者所知的版本号(直到 5.5 版本)截然不同。例如,Internet Explorer 2.0 的版本号是“4.40.520”。我本以为会看到类似“2.0.xxx”的东西。此外,版本号的递增方式与产品名称中的递增方式不同。例如,Internet Explorer 3.0 的版本号是“4.70.1155”,而不是像“5.x.x”这样的格式,因为 2.0 版本是以“4.x.x”开头的。您将不得不使用一个查找表来将版本号与产品名称进行匹配。
还有一个小问题,就是如何通过编程方式检索版本号。Internet Explorer 的每个主要版本(直到 4.0 版本)都引入了不同的方法来从注册表中识别版本号;它最初是从 IVer 字符串开始,然后是 Build 字符串,最后是 Version 字符串。
微软似乎终于清醒过来了。现在,版本号与其市场宣传的版本号相对应(例如,Internet Explorer 5.5 的版本号是“5.50.4134.0600”),我们可以使用 Version 字符串值从注册表中获取完整的版本字符串。
但是,如果您仍然像我一样,需要确定 Internet Explorer 4.0 之前的版本,那么在继续之前,请先吃一片阿司匹林来缓解头痛。
免责声明
本文包含从 MSDN 提取的信息。
从注册表确定 Internet Explorer 版本
已安装的 Internet Explorer 的版本号可以在以下注册表项下找到:
HKEY_LOCAL_MACHINE\
Software\
Microsoft\
Internet Explorer
适用于 Windows 95 的 Internet Explorer 1.0(包含在 Microsoft Plus! for Windows 95 中)在此项下有一个 IVer 字符串值,其值为“100”。
适用于 Windows 95 的 Internet Explorer 2.0 将 IVer 字符串值更新为“102”,并在同一项下添加了一个 Build 字符串值,其值为“520”。
Windows NT 4.0 中包含的 Internet Explorer 版本不会向注册表添加 Build 值,但它们会将 IVer 字符串值更新为“101”。
Internet Explorer 3.x 修改了 Build 字符串值,并将 IVer 字符串值更新为“103”。请注意,此版本中的 Build 值是一个包含四位构建号的字符串(例如,Internet Explorer 3.02 的构建号是“1300”)。
对于 Internet Explorer 4.0 及更高版本,Build 值是一个包含五位数值的字符串,后跟一个句点和另外四位字符,格式如下:
major-version-build-number.sub-build-number
例如,Internet Explorer 5 的 Build 值为“52014.0216”。
此外,它在同一项下添加了一个 Version 字符串值,格式如下:
major-version.minor-version.build-number.sub-build-number
例如,Internet Explorer 5 的 Version 值为“5.00.2014.0216”。
如果注册表中没有这些值,则说明 Internet Explorer 未正确安装或根本没有安装。
从 Shdocvw.dll 确定 Internet Explorer 版本
您可以使用 Shdocvw.dll(Shell 文档对象和控件库)文件的版本号来确定所安装的 Internet Explorer 版本。但是请注意,此方法仅适用于 Internet Explorer 3.0 及更高版本,因为此文件在早期版本的 Internet Explorer 中不存在。
此外,请注意,此 dll 的版本号与注册表中存储的版本号不同。(虽然较新版本的版本号开始趋于一致。)您可以在此处找到一个列出了 Shdocvw.dll 文件版本号和相应 Internet Explorer 版本的表格。
在 Windows 95/98 中,Shdocvw.dll 文件安装在 Windows\System 文件夹中;在 Windows NT/2000 中,则安装在 Winnt\System32 文件夹中。如果 Shdocvw.dll 文件不存在,则说明 Internet Explorer 3.0 或更高版本未正确安装或根本没有安装。
以下 WIN32 函数可检索本地系统上安装的 Shdocvw.dll 的主版本号、次版本号和构建号。
#include "windows.h" #include "shlwapi.h" HRESULT GetBrowserVersion(LPDWORD pdwMajor, LPDWORD pdwMinor, LPDWORD pdwBuild) { HINSTANCE hBrowser; if(IsBadWritePtr(pdwMajor, sizeof(DWORD)) || IsBadWritePtr(pdwMinor, sizeof(DWORD)) || IsBadWritePtr(pdwBuild, sizeof(DWORD))) return E_INVALIDARG; *pdwMajor = 0; *pdwMinor = 0; *pdwBuild = 0; //Load the DLL. hBrowser = LoadLibrary(TEXT("shdocvw.dll")); if(hBrowser) { HRESULT hr = S_OK; DLLGETVERSIONPROC pDllGetVersion; pDllGetVersion = (DLLGETVERSIONPROC)GetProcAddress(hBrowser, TEXT("DllGetVersion")); if(pDllGetVersion) { DLLVERSIONINFO dvi; ZeroMemory(&dvi, sizeof(dvi)); dvi.cbSize = sizeof(dvi); hr = (*pDllGetVersion)(&dvi); if(SUCCEEDED(hr)) { *pdwMajor = dvi.dwMajorVersion; *pdwMinor = dvi.dwMinorVersion; *pdwBuild = dvi.dwBuildNumber; } } else { //If GetProcAddress failed, there is a problem // with the DLL. hr = E_FAIL; } FreeLibrary(hBrowser); return hr; } return E_FAIL; }
Internet Explorer 版本历史
Internet Explorer 的版本号使用以下格式:
major-version.minor-version.build-number.sub-build number
Internet Explorer 版本完整列表
版本 | 产品 |
---|---|
4.40.308 | Internet Explorer 1.0 (Plus!) |
4.40.520 | Internet Explorer 2.0 |
4.70.1155 | Internet Explorer 3.0 |
4.70.1158 | Internet Explorer 3.0 (OSR2) |
4.70.1215 | Internet Explorer 3.01 |
4.70.1300 | Internet Explorer 3.02 和 3.02a |
4.71.544 | Internet Explorer 4.0 平台预览版 1.0 (PP1) |
4.71.1008.3 | Internet Explorer 4.0 平台预览版 2.0 (PP2) |
4.71.1712.6 | Internet Explorer 4.0 |
4.72.2106.8 | Internet Explorer 4.01 |
4.72.3110.8 | Internet Explorer 4.01 Service Pack 1 (SP1) |
4.72.3612.1713 | Internet Explorer 4.01 Service Pack 2 (SP2) |
5.00.0518.10 | Internet Explorer 5 开发者预览版 (Beta 1) |
5.00.0910.1309 | Internet Explorer 5 Beta (Beta 2) |
5.00.2014.0216 | Internet Explorer 5 |
5.00.2314.1003 | Internet Explorer 5 (Office 2000) |
5.00.2614.3500 | Internet Explorer 5 (Windows 98 第二版) |
5.00.2516.1900 | Internet Explorer 5.01 (Windows 2000 Beta 3,build 5.00.2031) |
5.00.2919.800 | Internet Explorer 5.01 (Windows 2000 RC1,build 5.00.2072) |
5.00.2919.3800 | Internet Explorer 5.01 (Windows 2000 RC2,build 5.00.2128) |
5.00.2919.6307 | Internet Explorer 5.01(也包含在 Office 2000 SR-1 中,但默认不安装) |
5.00.2920.0000 | Internet Explorer 5.01 (Windows 2000,build 5.00.2195) |
5.00.3103.1000 | Internet Explorer 5.01 SP1 (Windows 2000) |
5.00.3105.0106 | Internet Explorer 5.01 SP1 (Windows 95/98 和 Windows NT 4.0) |
5.00.3314.2101 | Internet Explorer 5.01 SP2 (Windows 95/98 和 Windows NT 4.0) |
5.00.3315.1000 | Internet Explorer 5.01 SP2 (Windows 2000) |
5.50.3825.1300 | Internet Explorer 5.5 开发者预览版 (Beta) |
5.50.4030.2400 | Internet Explorer 5.5 和 Internet 工具 Beta |
5.50.4134.0100 | Windows Me (4.90.3000) |
5.50.4134.0600 | Internet Explorer 5.5 |
5.50.4308.2900 | Internet Explorer 5.5 高级安全隐私 Beta |
5.50.4522.1800 | Internet Explorer 5.5 Service Pack 1 |
5.50.4807.2300 | Internet Explorer 5.5 Service Pack 2 |
6.00.2462.0000 | Internet Explorer 6 公开预览版 (Beta) |
6.00.2479.0006 | Internet Explorer 6 公开预览版 (Beta) Refresh |
6.00.2600.0000 | Internet Explorer 6 |
Shdocvw.dll 版本完整列表
版本 | 产品 |
---|---|
4.70.1155 | Internet Explorer 3.0 |
4.70.1158 | Internet Explorer 3.0 (OSR2) |
4.70.1215 | Internet Explorer 3.01 |
4.70.1300 | Internet Explorer 3.02 和 3.02a |
4.71.1008.3 | Internet Explorer 4.0 PP2 |
4.71.1712.5 | Internet Explorer 4.0 |
4.72.2106.7 | Internet Explorer 4.01 |
4.72.3110.3 | Internet Explorer 4.01 Service Pack 1 |
4.72.3612.1707 | Internet Explorer 4.01 SP2 |
4.72.3711.2900 | 已安装“服务器端页面引用重定向”问题更新的 Internet Explorer 4.x。 |
5.00.0518.5 | Internet Explorer 5 开发者预览版 (Beta 1) |
5.00.0910.1308 | Internet Explorer 5 Beta (Beta 2) |
5.00.2014.213 | Internet Explorer 5 |
5.00.2314.1000 | Internet Explorer 5 (Office 2000) |
5.00.2516.1900 | Internet Explorer 5.01 (Windows 2000 Beta 3,build 5.00.2031) |
5.00.2614.3500 | Internet Explorer 5 (Windows 98 第二版) |
5.00.2717.2000 | 已安装“格式错误的收藏夹图标”安全问题更新的 Internet Explorer 5。 |
5.00.2721.1400 | 已安装“ImportExport Favorites()”安全问题更新的 Internet Explorer 5。 |
5.00.2723.2900 | 已安装“服务器端页面引用重定向”问题更新的 Internet Explorer 5.0。 |
5.00.2919.800 | Internet Explorer 5.01 (Windows 2000 RC1,build 5.00.2072) |
5.00.2919.3800 | Internet Explorer 5.01 (Windows 2000 RC2,build 5.00.2128) |
5.00.2919.6307 | Internet Explorer 5.01(也包含在 Office 2000 SR-1 中,但默认不安装) |
5.00.2919.6400 | 已安装“服务器端页面引用重定向”问题更新的 Internet Explorer 5.01。 |
5.00.2920.0000 | Internet Explorer 5.01 (Windows 2000,build 5.00.2195) |
5.00.3103.1000 | Internet Explorer 5.01 SP1 (Windows 2000) |
5.00.3105.0106 | Internet Explorer 5.01 SP1 (Windows 95/98 和 Windows NT 4.0) |
5.00.3314.2100 | Internet Explorer 5.01 SP2 (Windows 95/98 和 Windows NT 4.0) |
5.00.3315.2879 | Internet Explorer 5.01 SP2 (Windows 2000) |
5.50.3825.1300 | Internet Explorer 5.5 开发者预览版 (Beta) |
5.50.4030.2400 | Internet Explorer 5.5 和 Internet 工具 Beta |
5.50.4134.0100 | Windows Me (4.90.3000) |
5.50.4134.0600 | Internet Explorer 5.5 |
5.50.4308.2900 | Internet Explorer 5.5 高级安全隐私 Beta |
5.50.4522.1800 | Internet Explorer 5.5 Service Pack 1 |
5.50.4807.2300 | Internet Explorer 5.5 Service Pack 2 |
6.00.2462.0000 | Internet Explorer 6 公开预览版 (Beta) |
6.00.2479.0006 | Internet Explorer 6 公开预览版 (Beta) Refresh |
6.00.2600.0000 | Internet Explorer 6 |