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. <