My program throws an exception below.
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)
{
geckoWebBrowser1.Navigate("http://www.google.com");
}
Translation from Chinese means the following:
"System .__ ComObject" cannot convert interface type "Gecko.nsIWebNavigation"
An exception is thrown in the following code:
public ChromeContext()
{
using (var appShallSvc = Xpcom.GetService2<nsIAppShellService>(Contracts.AppShellService))
{
webNav = appShallSvc.Instance.CreateWindowlessBrowser(true).AsComPtr();
webNav.Instance.LoadURI("chrome://global/content/alerts/alert.xul", 0, null, null, null);
}
}
Any help would be appreciated.
source
share