[英]Can't get Geckofx to work
如何在Visual Studio 2013中设置GeckoFX?
我从https://bitbucket.org/geckofx/geckofx-29.0/downloads下载了GeckoFS文件,并尝试将Geckofx-Core.dll
和Geckofx-Winforms.dll
到c#中的组件中。 那行得通,我以表格的形式创建了一个浏览器,但是在运行它时出现此错误:
An unhandled exception of type 'System.DllNotFoundException' occurred in Geckofx-Core.dll
Additional information: Unable to load DLL 'xul': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
我尝试将各种版本的xulrunner
添加到项目中,例如版本22和29,但这并没有消除错误。
我要做的只是制作一个简单的Windows窗体应用程序,该应用程序使用最新的GeckoFx-29打开GeckoFX浏览器。
首先,您需要下载xulrunner 29或Firefox 29。
当path是已安装的xulrunner 29或Firefox 29的文件夹时,您需要调用Xpcom.Initialize(path)
。
例如,如果您将Firefox 29安装到“ c:\\ program Files x86 \\ Mozilla Firefox \\”
然后,您将调用Xpcom.Initialize(@"c:\\program Files x86\\Mozilla Firefox\\")
这告诉geckofx在哪里可以找到xul.dll。
然后,您可以在Winforms应用程序中使用GeckoWebBrowser控件。
注意-您还应确保您的Main入口点具有[STAThread]
属性。
就我而言,此错误是由于我在Form1_Load
函数中初始化了xulrunner
引起的。 我通过在public Form1()
函数中初始化xulrunner
来解决它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.