简体   繁体   中英

Can't get Geckofx to work

How do I set up GeckoFX in Visual Studio 2013?

I downloaded the GeckoFS files from https://bitbucket.org/geckofx/geckofx-29.0/downloads and tried to add Geckofx-Core.dll and Geckofx-Winforms.dll to components in c#. That worked and I created a browser in a form but when running it I got this error:

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)

I tried adding various versions of xulrunner to the project like version 22 and 29 but that didn't remove the error.

All I would like to do is make a simple windows form application that opens a GeckoFX browser using the latest GeckoFx-29.

Firstly you need to download either xulrunner 29 or Firefox 29.

The you need to call Xpcom.Initialize(path) when path is the folder of the installed xulrunner 29 or Firefox 29.

For example If you installed Firefox 29 to "c:\\program Files x86\\Mozilla Firefox\\"

Then you would call Xpcom.Initialize(@"c:\\program Files x86\\Mozilla Firefox\\")

This tells geckofx where to find xul.dll.

Then you can use the GeckoWebBrowser control in your winforms application.

Note - you should also ensure that your Main entry point has the [STAThread] attribute.

In my case this error is caused because of I initialised xulrunner in Form1_Load function. I resolved it by initialising xulrunner in public Form1() function.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM