[Ie programming] How to obtain the IE version number

Source: Internet
Author: User

When the program uses the IE webbrowser control (mshtml) or develops the BHO plug-in, it usually needs to obtain the IE version number for different processing. Here we will introduce how to obtain the IE version number in step 2:

 

1) use the registry

The IE version number is in the registry:

 

HKEY_LOCAL_MACHINE/software/Microsoft/Internet Explorer/version

 

Note: 32-bit ie on 64-bit machinesHKEY_LOCAL_MACHINE/software/wow6432node/Microsoft/Internet Explorer/version

 

 

2) read the version number of mshtml. dll.

 

Mshtml is one of the core DLL of IE. The version number of the mshtml. dll file must be the same as that of IE. The following code obtains the version number of mshtml. dll.

Const tchar szfilename [] = _ T ("mshtml. DLL "); <br/> DWORD dwmajorversion = 0, dwminorversion = 0; <br/> DWORD dwbuildnumber = 0, dwrevisionnumber = 0; <br/> DWORD dwhandle = 0; <br/> DWORD dwverinfosize = getfileversioninfosize (szfilename, & dwhandle); <br/> If (dwverinfosize) <br/> {<br/> lpvoid lpbuffer = localalloc (lptr, dwverinfosize); <br/> If (lpbuffer) <br/>{< br/> If (getfileversioninfo (szfilename, dwhandle, dwverinfosize, lpbuffer )) <br/>{< br/> vs_fixedfileinfo * lpfixedfileinfo = NULL; <br/> uint nfixedfileinfosize = 0; <br/> If (verqueryvalue (lpbuffer, text ("//"), (lpvoid *) & lpfixedfileinfo, & nfixedfileinfosize) & (nfixedfileinfosize )) <br/>{< br/> dwmajorversion = hiword (lpfixedfileinfo-> dwfileversionms); <br/> dwminorversion = loword (lpfixedfileinfo-> dwfileversionms ); <br/> dwbuildnumber = hiword (lpfixedfileinfo-> dwfileversionls); <br/> dwrevisionnumber = loword (lpfixedfileinfo-> dwfileversionls ); <br/>}< br/> localfree (lpbuffer); <br/>}< br/> printf ("mshtml. DLL versioninfo:/n/tmajorversion = % d/n/tminorversion = % d/n/tbuildnumber = % d/n/trevisionnumber = % d/N ", <br/> dwmajorversion, dwminorversion, dwbuildnumber, dwrevisionnumber );

 

 

After obtaining the majorversion, minorversion, buildnumber, and revisionnumber through the above two methods, you can query the table in my previous blog article IE version list to determine which IE release version is used.

 

Related blog articles:

IE8 official version (RTM): 8.0.6001.18702
[Ie programming] IE version

 

 

> Original article copyright belongs to the author, reprint please indicate the source and author information (http://blog.csdn.net/WinGeek/), thank you. <

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.