Nicolas Weber wrote:

Hi,

I don't want to download the mozilla source, because it's quite huge
and its compilation requires several tools which are also not small
(perl, cygwin, ...).

I read previous posts in this newsgroup and got the impression that I
can write an embedding app with just the gecko sdk (and a binary
version of mozilla installed, so that I have a GRE somewhere on my
disk).

All the samples that I found (winembed, mfcembed, g-melon) do do_CreateInstance(NS_WEBBROWSER_CONTRACTID)
somewhere at their beginning. However, neither do_CreateInstance nor
NS_WEBBROWSER_CONTRACTID are exported by the headers that come with
the gecko sdk (at least that's what grep tells me).


Can you help me? If it is somehow possible I don't want to get the
mozilla sources.

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



Yeah, it is unfortunate that the Gecko embedding samples do not correspond with the Gecko SDK!! :-(


You can get around this problem by using NS_GetComponentManager and nsIComponentManager instead.

nsresult CreateInstance(const char *aContractID, const nsIID &aIID,
                       void **aInstancePtr)
{
 nsresult rv;

 nsCOMPtr<nsIComponentManager> compMgr;
 rv = NS_GetComponentManager(getter_AddRefs(compMgr));
 if (NS_FAILED(rv))
   return rv;

 return compMgr->CreateInstanceByContractID(aContractID, NULL, aIID,
                                            aInstancePtr);
}

With this function, you can write:

nsCOMPtr<nsIFoo> foo;
rv = CreateInstance(NS_FOO_CONTRACTID, NS_GET_IID(nsIFoo),
                   getter_AddRefs(foo));
if (NS_FAILED(rv))
 return rv;

For more info on nsIComponentManager, see:
http://developer-test.mozilla.org/xpcom/api/nsIComponentManager
http://developer-test.mozilla.org/xpcom/api/NS_GetComponentManager

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

Reply via email to