Load embedded pages with the highest version of the IE kernel installed with Windows (reprint)

Source: Internet
Author: User

When a client program embeds a WebBrowser control, the Web page is opened by default using IE7 compatibility mode. However, IE7 has a lot of new features not supported, resulting in the inability to display properly, so you need to force the use of a higher version of IE kernel to load, render.

1 voidChangeregedit (Constwchar_t*pexename)2 {3 if(NULL = =pexename)4 return ;5TCHAR szversion[ -] = {0}; 6DWORD dwsize = -; 7 HKEY HKEY;8 //get the IE version First9 if(Error_success = = RegOpenKeyEx (HKEY_LOCAL_MACHINE, TEXT ("software\\microsoft\\internet Explorer"),0, Key_read, &HKey))Ten { One //first read the location of the IE11 ADWORD dwieversion =0; - if(Error_success = = RegQueryValueEx (HKey, L"svcversion",0, NULL, (LPBYTE) szversion, &dwsize)) - { theTCHAR *pos = _TCSCHR (szversion, TEXT ('.')); - if(POS) -Dwieversion =_ttoi (szversion); - } + if(Dwieversion = =0 ) -{//read the location of the low version of IE + if(Error_success = = (HKey, L"Version",0, NULL, (LPBYTE) szversion, &dwsize)) A { atTCHAR *pos = _TCSCHR (szversion, TEXT ('.')); - if(NULL = =POS) - { - RegCloseKey (HKey); - return ; - } in*pos =0; -Dwieversion =_ttoi (szversion); to } + } - RegCloseKey (HKey); the Switch(dwieversion) * { $  Case  One: Dwieversion =11001; Break;Panax Notoginseng  Case Ten: Dwieversion =10001; Break; -  Case 9: Dwieversion =9999; Break; the  Case 8: Dwieversion =8888; Break; + default:return ; A } the //set the IE version used by the application + if(Error_success = = RegOpenKeyEx (HKEY_LOCAL_MACHINE, L"software\\microsoft\\internet explorer\\main\\featurecontrol\\feature_browser_emulation",0, Key_write, &HKey)) - { $dwsize =sizeof(dwieversion); $RegSetValueEx (HKey, Pexename,0, REG_DWORD, (LPBYTE) &dwieversion, dwsize); - RegCloseKey (HKey); - } the } -}

Reprint: http://blog.csdn.net/mfcing/article/details/50460433

Load embedded pages with the highest version of the IE kernel installed with Windows (reprint)

Related Article

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.