Set WebBrowser Core to IE 11 for Application

private void setReg()
{
string myAppPath = System.IO.Path.GetFileName(System.Reflection.Assembly.GetExecutingAssembly().Location);
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", true);
int ieVer = 11001;
if (key != null)
{
key.SetValue(myAppPath, ieVer, RegistryValueKind.DWord);
key.SetValue(myAppPath.Replace(".exe", ".vshost.exe"), ieVer, RegistryValueKind.DWord);//调试运行需要加上,否则不起作用
}

key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", true);
if (key != null)
{
key.SetValue(myAppPath, ieVer, RegistryValueKind.DWord);
key.SetValue(myAppPath.Replace(".exe", ".vshost.exe"), ieVer, RegistryValueKind.DWord);//调试运行需要加上,否则不起作用
}
}

猜你喜欢

转载自www.cnblogs.com/xyphoenix/p/12242619.html