初始化C#的geckoWebBrowser异常
发布时间:2020-12-15 21:03:58 所属栏目:百科 来源:网络整理
导读:我的程序如下引发异常. Program.cs如下: static void Main() { Gecko.Xpcom.Initialize("D:xulrunner"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } Form1.cs如下: p
我的程序如下引发异常.
Program.cs如下: static void Main() { Gecko.Xpcom.Initialize("D:xulrunner"); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } Form1.cs如下: private void Form1_Load(object sender,EventArgs e) { //Gecko.Xpcom.Initialize("D:xulrunner"); geckoWebBrowser1.Navigate("http://www.google.com"); } 翻译自中文,例外情况如下: “System .__ ComObject”无法转换接口类型“Gecko.nsIWebNavigation” 以下代码中抛出异常: public ChromeContext() { using (var appShallSvc = Xpcom.GetService2<nsIAppShellService>(Contracts.AppShellService)) { webNav = appShallSvc.Instance.CreateWindowlessBrowser(true).AsComPtr(); //this is where the exception is thrown webNav.Instance.LoadURI("chrome://global/content/alerts/alert.xul",null,null); } } 任何帮助将不胜感激. 解决方法
对于旧版本,您需要将GeckoFX版本与xulrunner的完全正确版本相匹配.
在这里查看您的版本:https://bitbucket.org/geckofx/geckofx/wiki/Version_lists 在这里下载xulrunner:https://releases.mozilla.org/pub/xulrunner/releases/ 但是版本45.0大大简化了这一点:
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- flex – Flash Builder 4 – Flash Player无法连接到调试器
- 使用Swift中的UIAlertController更改警报的标题和消息字体
- 我怎样才能加速XML :: Twig
- cocos2d-x 学习过程错误记录--Xcode+cocos2d-x 3.3 资源文件
- PostgreSQL忘记输入where条件update更新整张表的解决办法
- SQLite数据库实例五
- c – Linux:Qt Creator调试器在创建QQmlApplicationEngine
- ruby-on-rails – Turbolinks和3D派对插件问题?
- c# – 如何从数据集中设置DataGridViewComboBoxColumn值
- c# – 使用转换器将Window Title绑定到属性