在WebBrowser控件使用最新版本的IE [英] use latest version of ie in webbrowser control

查看:589
本文介绍了在WebBrowser控件使用最新版本的IE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认在C#应用winfrom WebBrowser控件版本7我有这样的文章的浏览器仿真但怎么可能使用最新版本的安装Internet Explorer的浏览器控件

default version of webbrowser control in c# winfrom application is 7 i have changed to 9 by this article Browser Emulation but how is it possible to use the latest version of installed internet explorer in webbrowser control

推荐答案

我看到了德维尔的答案,我认为这是正确的,但并没有为我工作,可我使用.NET 4中,并用64倍的操作系统,所以查收这

I saw Veer's Answer, I think it's right but did not worked for me, may be i am using .net 4, and using 64x OS so kindly check this

你可以把在设置或检查它在你的应用程序的启动

private void Form1_Load(object sender, EventArgs e)
{

    var appName = Process.GetCurrentProcess().ProcessName + ".exe";
    SetIE8KeyforWebBrowserControl(appName);
}

private void SetIE8KeyforWebBrowserControl(string appName)
{
    RegistryKey Regkey = null;
    try
    {

        //For 64 bit Machine 
        if (Environment.Is64BitOperatingSystem)
            Regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Wow6432Node\\Microsoft\\Internet Explorer\\MAIN\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);
        else  //For 32 bit Machine 
            Regkey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION", true);

        //If the path is not correct or 
        //If user't have priviledges to access registry 
        if (Regkey == null)
        {
            MessageBox.Show("Application Settings Failed - Address Not found");
            return;
        }

        string FindAppkey = Convert.ToString(Regkey.GetValue(appName));

        //Check if key is already present 
        if (FindAppkey == "8000")
        {
            MessageBox.Show("Required Application Settings Present");
            Regkey.Close();
            return;
        }

        //If key is not present add the key , Kev value 8000-Decimal 
        if (string.IsNullOrEmpty(FindAppkey))
            Regkey.SetValue(appName, unchecked((int)0x1F40), RegistryValueKind.DWord);

        //check for the key after adding 
        FindAppkey = Convert.ToString(Regkey.GetValue(appName));

        if (FindAppkey == "8000")
            MessageBox.Show("Application Settings Applied Successfully");
        else
            MessageBox.Show("Application Settings Failed, Ref: " + FindAppkey);


    }
    catch (Exception ex)
    {
        MessageBox.Show("Application Settings Failed");
        MessageBox.Show(ex.Message);
    }
    finally
    {
        //Close the Registry 
        if (Regkey != null)
            Regkey.Close();
    }


}

您可能会发现messagebox.show,只是为了测试

you may found messagebox.show , just for test

键是为以下;

9999(0x270F) - !是Internet Explorer 9网页将显示在IE9标准模式,无论DOCTYPE指令

9999 (0x270F) - Internet Explorer 9. Webpages are displayed in IE9 Standards mode, regardless of the !DOCTYPE directive.

9000(0x2328) - !是Internet Explorer 9的网页包含基于标准的DOCTYPE指令显示在IE9模式

9000 (0x2328) - Internet Explorer 9. Webpages containing standards-based !DOCTYPE directives are displayed in IE9 mode.

8888(0x22B8) - !网页显示在IE8标准模式,无论DOCTYPE指令

8888 (0x22B8) - Webpages are displayed in IE8 Standards mode, regardless of the !DOCTYPE directive.

8000(0x1F40) - 含网页基于标准的DOCTYPE指令显示在IE8模式

8000 (0x1F40) - Webpages containing standards-based !DOCTYPE directives are displayed in IE8 mode.

7000(0x1B58) - 包含网页基于标准的DOCTYPE指令显示在IE7标准模式

7000 (0x1B58) - Webpages containing standards-based !DOCTYPE directives are displayed in IE7 Standards mode.

我看到的应用,如Skype的使用10001,我不知道

I saw applications like skype use 10001, i do not know

注意

设置应用将改变注册表,您可能需要添加变线清单文件,以避免错误是由于注册表更改的权限

the setup app will change registry, you may need to add change line in Manifest File to avoid errors due to permissions of change in registry

<requestedExecutionLevel level="highestAvailable" uiAccess="false" />

问候

这篇关于在WebBrowser控件使用最新版本的IE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆