"Mathieu CARTOIXA" <[EMAIL PROTECTED]> a �crit dans
le message de news:[EMAIL PROTECTED]
>     // Request the nsIWebBrowserPrint interface
>     nsCOMPtr<nsIWebBrowserPrint>
> nspWebBrowserPrint(do_QueryInterface(m_nspPrinter, &rv));
>
> At this point, rv==0x80004002 (NS_NOINTERFACE), though this is very
similar
> to
>
http://lxr.mozilla.org/seamonkey/source/embedding/browser/activex/src/control/MozillaBrowser.cpp#1461
>
> So the problem here is that the WebBrowserPrint interface is somehow not
> implemented by my WebBrowser instance, though it should, as far as the
> documentation I have read is concerned :
> http://www.mozilla.org/projects/embedding/faq.html
>

    OK, I found my error. My code was indeed very similar to the example,
but actually not the same :
nsCOMPtr<nsIWebBrowserPrint>
nspWebBrowserPrint(do_GetInterface(m_nspPrinter, &rv));
does the trick. For those who don't see the difference (like I used to...),
I just replaced do_QueryInterface with do_GetInterface.

    I found the difference by hacking nsWebBrowser.cpp. I found that the
browser object does not actually implement the nsIWebBrowserPrint interface.
If I understood well, it's the document that implements it, and the browser
gives access to it through its implementation of the nsIInterfaceRequestor
interface. I think the difference is very subtle, and should be emphasized a
lot more in the documentations.

                    Mathieu CARTOIXA


_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to