Sombatth / geckofx

Automatically exported from code.google.com/p/geckofx
0 stars 0 forks source link

Not able to navigating the Geko browser in a single threaded application #7

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello,
I am creating only one instance of the browser and using Single thread.

My code is as follows
string m_DomHtml = string.Empty;
            string m_stackTrace = string.Empty;
            int m_statuscode = 0;
            string targetUrl = appendURL(url);
            geckoWebBrowser1.CreateControl();
            geckoWebBrowser1.Navigate(targetUrl);

But then I am getting the error as .........Unable to cast COM object of 
type 'System.__ComObject' to interface 
type 'Skybound.Gecko.nsIWebNavigation'. This operation failed because the 
QueryInterface call on the COM component for the interface with 
IID '{F5D9E7B0-D930-11D3-B057-00A024FFC08C}' failed due to the following 
error: No such interface supported (Exception from HRESULT: 0x80004002 
(E_NOINTERFACE)).

Regards,
bhavin.chheda@vizualize.com

Original issue reported on code.google.com by bmchhe...@gmail.com on 14 Aug 2008 at 1:05

GoogleCodeExporter commented 9 years ago
Having the same problem here. I'm getting this error using multiple and single 
threads.

"Unable to cast COM object of type 'System.__ComObject' to interface type 
'Skybound.Gecko.nsIWebNavigation'." at run time. Mine fails on the line:

wbInfo.Navigate("http://www.google.com");

Where wbInfo is my GeckoWebBrowser object.

Original comment by Tea...@gmail.com on 14 Feb 2009 at 7:07

GoogleCodeExporter commented 9 years ago
Unable to cast COM object of type 'System.__ComObject' to interface type
'Skybound.Gecko.nsIWebNavigation'. This operation failed because the 
QueryInterface
call on the COM component for the interface with IID
'{F5D9E7B0-D930-11D3-B057-00A024FFC08C}' failed due to the following error: No 
such
interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Same problem here.
Note: Using the browser in a tab.

Original comment by Liubomir...@gmail.com on 16 Mar 2009 at 8:56

GoogleCodeExporter commented 9 years ago
The same... 

Original comment by Valentin...@gmail.com on 19 Jan 2010 at 2:52

GoogleCodeExporter commented 9 years ago
This error is thrown when you're trying to access the GeckoFX browser from a new
non-UI thread. Code sample that works:

void AsyncNavigate(string url) {
  ThreadStart starter = delegate { AsyncNavigateThread(url); };
  Thread thread = new Thread(starter);
  thread.IsBackground = true;
  thread.Start();
}

private delegate void StringDelegate(string url);
private void AsyncNavigateThread(string url) {
  if (this == null || this.IsDisposed) return;
  if (this.InvokeRequired || webBrowser.InvokeRequired) {
    this.BeginInvoke(new StringDelegate(AsyncNavigateThread), new object[] { url });
    return;
  }
  webBrowser.Navigate(url);
}

We need a better exception message though!

Original comment by rebelbet...@gmail.com on 19 Jan 2010 at 3:57

GoogleCodeExporter commented 9 years ago
I am trying to use GeckoFX because the standard WebBrowser control struggles 
handling javascript in a number of areas.  My implementation with WebBrowser 
control runs in a ApartmentState.STA thread that has no UI.  I have been unable 
to get GeckFX to work in this scenario.  I get an error stating that I cannot 
navigate before the window handle is created and if I call CreateControl() on 
th GeckoFX browser control, I get an object is null exception from the naviagte 
call.  The delegate code above is incomplete, so I wonder if you could post a 
more complete answer.

Alos, might the right answer be to write a version of GeckoFX that does not 
inherit from Control.

Any thoughts would be appreciated.

Original comment by adwo...@pcx.us.com on 18 Oct 2010 at 4:10

GoogleCodeExporter commented 9 years ago
Hey all...I am using the GeckoWebBrowser 1.9.1.0 in a .NET 2.0 application with 
the XURLrunner 1.9.2.12 and have the same problem when executing this line of 
code: webBrowser.Document.ActiveElement;

Unable to cast COM object of type 'System.__ComObject' to interface type 
'Skybound.Gecko.nsIDOMNSDocument'. This operation failed because the 
QueryInterface call on the COM component for the interface with IID 
'{533A8131-8D0C-4EBF-990B-7FAD7CD514EE}' failed due to the following error: No 
such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Nothing works...
--> I tried to use the AsyncNavigate hint
--> I tried to use the GeckoWebBrowser outside of a TabControl within a new 
Form()

Everything I want to get work is to move the focus to the flash content when 
the DocumentCompleted event raised. Does someone have an idea how to solve this 
problem? I am happy for every hint.

Original comment by o.schum...@googlemail.com on 22 Nov 2010 at 8:44

GoogleCodeExporter commented 9 years ago
Hello,all:
    My code is as follows:
    private void button1_Click(object sender, EventArgs e)
        {
            Browser.Navigate("http://www.baidu.com");

            GeckoElement script = Browser.Document.CreateElement("script");
            script.SetAttribute("type", "text/javascript");
            string str = "alert('ptmind');";
            script.TextContent = str;
            Browser.Document.Body.AppendChild(script);
        }
while running GeckoElement script = 
Browser.Document.CreateElement("script"),appear a error message as follow:

Unable to cast COM object of type 'System.__ComObject' to interface type 
'Skybound.Gecko.nsIDOMNSDocument'. This operation failed because the 
QueryInterface call on the COM component for the interface with IID 
'{533A8131-8D0C-4EBF-990B-7FAD7CD514EE}' failed due to the following error: No 
such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

Regards
sun.weichao@yahoo.com

Original comment by sun.weic...@yahoo.com on 11 Jan 2011 at 9:46