c获取IE版本号
原文链接:http://mzf2008.blog.163.com/blog/static/35599786201092422325687/
程序中使用IE的WebBrowser 控件(MSHTML)或者开发BHO插件的时候,通常需要获得IE的版本号以便做不同处理。这里介绍2中获得IE版本号的方法:
1) 通过注册表
IE的版本号信息放在注册表的:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version
注:64位机器的32位IE在 HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\Version
2) 通过读取mshtml.dll 的版本号
mshtml是IE的核心DLL之一。 mshtml.dll文件的版本号码和IE的版本号码应该是一致的。以下代码演示如何获得mshtml.dll的版本号。
#include "stdafx.h"
#include <Windows.h>
#include <stdio.h>
#include <TCHAR.h>
int main(void)
{
TCHAR szFilename[] = _T("mshtml.dll");
DWORD dwMajorVersion =0, dwMinorVersion = 0;
DWORD dwBuildNumber =0, dwRevisionNumber = 0;
DWORD dwHandle = 0;
DWORD dwVerInfoSize = GetFileVersionInfoSize(szFilename, &dwHandle);
if (dwVerInfoSize)
{
LPVOID lpBuffer = LocalAlloc(LPTR, dwVerInfoSize);
if (lpBuffer)
{
if (GetFileVersionInfo(szFilename, dwHandle, dwVerInfoSize, lpBuffer))
{
VS_FIXEDFILEINFO * lpFixedFileInfo = NULL;
UINT nFixedFileInfoSize = 0;
if (VerQueryValue(lpBuffer, TEXT("\\"), (LPVOID*)&lpFixedFileInfo, &nFixedFileInfoSize) &&(nFixedFileInfoSize))
{
dwMajorVersion = HIWORD(lpFixedFileInfo->dwFileVersionMS);
dwMinorVersion = LOWORD(lpFixedFileInfo->dwFileVersionMS);
dwBuildNumber = HIWORD(lpFixedFileInfo->dwFileVersionLS);
dwRevisionNumber = LOWORD(lpFixedFileInfo->dwFileVersionLS);
}
}
LocalFree(lpBuffer);
}
}
printf("mshtml.dll VersionInfo: \n\tMajorVersion=%d\n\tMinorVersion=%d\n\tBuildNumber=%d\n\tRevisionNumber=%d\n",
dwMajorVersion, dwMinorVersion, dwBuildNumber, dwRevisionNumber);
return 0;
}
通过以上2种方法获得 MajorVersion, MinorVersion, BuildNumber, RevisionNumber.
IE版本号
Version Product
-----------------------------------------------------------------
4.40.308 Internet Explorer 1.0 (Plus! for Windows 95)
4.40.520 Internet Explorer 2.0
4.70.1155 Internet Explorer 3.0
4.70.1158 Internet Explorer 3.0 (Windows 95 OSR2)
4.70.1215 Internet Explorer 3.01
4.70.1300 Internet Explorer 3.02 and 3.02a
4.71.544 Internet Explorer 4.0 Platform Preview 1.0 (PP1)
4.71.1008.3 Internet Explorer 4.0 Platform Preview 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 (Windows 98)
4.72.3612.1713 Internet Explorer 4.01 Service Pack 2
5.00.0518.10 Internet Explorer 5 Developer Preview (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 Second Edition)
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 SP1)
5.00.3105.0106 Internet Explorer 5.01 SP1 (Windows 95/98 and Windows NT 4.0)
5.00.3314.2101 Internet Explorer 5.01 SP2 (Windows 95/98 and Windows NT 4.0)
5.00.3315.1000 Internet Explorer 5.01 SP2 (Windows 2000 SP2)
5.00.3502.1000 Internet Explorer 5.01 SP3 (Windows 2000 SP3 only)
5.00.3700.1000 Internet Explorer 5.01 SP4 (Windows 2000 SP4 only)
5.50.3825.1300 Internet Explorer 5.5 Developer Preview (Beta)
5.50.4030.2400 Internet Explorer 5.5 & Internet Tools Beta
5.50.4134.0100 Internet Explorer 5.5 for Windows Me (4.90.3000)
5.50.4134.0600 Internet Explorer 5.5
5.50.4308.2900 Internet Explorer 5.5 Advanced Security Privacy 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 Public Preview (Beta)
6.00.2479.0006 Internet Explorer 6 Public Preview (Beta) Refresh
6.00.2600.0000 Internet Explorer 6 (Windows XP)
6.00.2800.1106 Internet Explorer 6 Service Pack 1 (Windows XP SP1)
6.00.2900.2180 Internet Explorer 6 for Windows XP SP2
6.00.2900.5512 Internet Explorer 6 for Windows XP SP3
6.00.3663.0000 Internet Explorer 6 for Windows Server 2003 RC1
6.00.3718.0000 Internet Explorer 6 for Windows Server 2003 RC2
6.00.3790.0000 Internet Explorer 6 for Windows Server 2003 (released)
6.00.3790.1830 Internet Explorer 6 for Windows Server 2003 SP1 and Windows XP x64
6.00.3790.3959 Internet Explorer 6 SP2 for Windows Server 2003 SP1 and Windows XP x64
7.00.5730.1100 Internet Explorer 7 for Windows XP and Windows Server 2003
7.00.5730.1300 Internet Explorer 7 for Windows XP and Windows Server 2003
7.00.6000.16386 Internet Explorer 7 for Windows Vista
7.00.6000.16441 Internet Explorer 7 for Windows Server 2003 SP2 x64
7.00.6000.16441 Internet Explorer 7 for Windows XP SP2 x64
7.0.6001.1800 Internet Explorer 7 for Windows Server 2008 and for Windows Vista SP1
8.0.6001.17184 Internet Explorer 8 Beta 1
8.0.6001.18702 IE8 for Windows XP SP2/SP3、Windows XP Pro x64、Windows Server 2003 R2 SP2和Windows Vista
9.0.8112.16421 IE9 for Windows Vista SP2和Windows 7/SP1,不支持Windows XP
10.0.9200.16384 IE10 for Windows 7和Windows 8,不支持Windows Vista
11.0.9431.0 IE11
8.00.6001.18241 Internet Explorer 8 Beta 2
浙公网安备 33010602011771号