首页 > Web开发 > 详细

设置webbrowser浏览器内核

时间:2016-05-07 18:15:47      阅读:192      评论:0      收藏:0      [点我收藏+]

var hklm = Microsoft.Win32.Registry.LocalMachine;
            var lmRun64 = hklm.OpenSubKey(@"SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", true);
            var lmRun32 = hklm.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION", true);
            //获取路径的方法
            string location64 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
            string fileName64 = System.IO.Path.GetFileName(location64);
            string location32 = this.GetType().Assembly.Location;
            string fileName32 = System.IO.Path.GetFileName(location32);
            if (lmRun64 != null)
            {
                string value64 = null;

                var xx = lmRun64.GetValue(fileName64);
                if (xx != null)
                {
                    value64 = Convert.ToString(lmRun64.GetValue(fileName64));
                }
                if (string.IsNullOrEmpty(value64))
                {
                    //lmRun64.SetValue("TemplateBrowser.exe", 0x2710); //设置webbrowser调用IE10内核打开
                    lmRun64.SetValue(fileName64, 0x2710); //设置webbrowser调用IE10内核打开
                    lmRun64.SetValue(fileName32, 0x2710); //设置webbrowser调用IE10内核打开
                }

            }

            if (lmRun32 != null)
            {
                string value32 = null;
                var xx = lmRun32.GetValue(fileName32);
                if (xx != null)
                {
                    value32 = Convert.ToString(lmRun32.GetValue(fileName32));
                }

                if (string.IsNullOrEmpty(value32))
                {
                    //lmRun32.SetValue("TemplateBrowser.exe", 0x2710); //设置webbrowser调用IE10内核打开
                    lmRun32.SetValue(fileName32, 0x2710); //设置webbrowser调用IE10内核打开
                    lmRun32.SetValue(fileName64, 0x2710); //设置webbrowser调用IE10内核打开
                }
            }


            wb.Url = new Uri("http://www.dcwriter.cn/");

设置webbrowser浏览器内核

原文:http://www.cnblogs.com/edangame/p/5468788.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!