My program below throws an exception.
Program.cs is as follows:
static void Main()
{
Gecko.Xpcom.Initialize("D:\\xulrunner\\");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
Form1.cs is as follows:
private void Form1_Load(object sender, EventArgs e)
{
//Gecko.Xpcom.Initialize("D:\\xulrunner\\");
geckoWebBrowser1.Navigate("http://www.google.com");
}
Translated from Chinese, the exception is as follows:
"System.__ComObject" cannot convert Interface type "Gecko.nsIWebNavigation"
The exception is thrown in the following code:
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", 0, null, null, null);
}
}
Any help will be appreciated.