I see an article
(http://www.mozilla.org/editor/Editor_Embedding_Guide.html) and a
source code comment int the article interests me :

nsCOMPtr<nsIDOMWindow> domWindow;
  nsresult rv = nsIWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
  if (NS_FAILED(rv)) return NS_ERROR_FAILURE; // we are not setup??!!

in fact in my developpement i'm exactly in the situation where NS_FAILED(rv)
is true and i don't understand why.

what does "we are not setup??!!" mean exactely ?

i spent a long time on this error so someone can please help me to
understand why i am facing this problem and how to resolve it ?

****************************************
you can read here my original post here :

http://news-reader.org/article.php?group=netscape.public.mozilla.xpcom&post_nr=4693

My post :
Hello, i use firefox 1.0.1 and write an component that need to retrieve
the current DOM of the current web page displayed in firefox.

But the code below does'nt work.

It crashes here (see complete source code below) :
rslt = webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));

(i have : rslt = NS_ERROR_UNEXPECTED)

Can you please give me some help ?
Here is my code :
// Component manager
nsCOMPtr<nsIComponentManager> componentManager;
nsresult rslt = NS_GetComponentManager(getter_AddRefs(componentManager));
if(NS_FAILED(rslt)) return rslt;

// WebBrowser
nsCOMPtr<nsIWebBrowser> webBrowser;

rslt = componentManager->CreateInstanceByContractID(
       "@mozilla.org/embedding/browser/nsWebBrowser;1",
       nsnull,
       NS_GET_IID(nsIWebBrowser),
       getter_AddRefs(webBrowser));

if(NS_FAILED(rslt)) return rslt;

// DOM
nsCOMPtr<nsIDOMWindow> domWindow;
rslt = webBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
if(NS_FAILED(rslt)) return rslt;
_______________________________________________
mozilla-embedding mailing list
[email protected]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to