I'm not sure about what version of the source you're using, but at least with mozilla 1.75, do_CreateInstance was excluded due to MOZILLA_STRICT_API, I believe. I had to do something like this:

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);
        }

and then make a call like so:

rv = CreateInstance(NS_WEBBROWSER_CONTRACTID, NS_GET_IID(nsIWebBrowser),

J

On May 3, 2006, at 9:05 AM, Richard wrote:

Hi,

So I finally had the NS_InitEmbedding working, however I had to do the
following :
rv = NS_InitEmbedding(binDir, nsnull);
f(NS_FAILED(rv))
{
    rv = NS_InitEmbedding(binDir, nsnull);
    if(NS_FAILED(rv))
    {
        return FALSE;
    }
}

THe first call always seemed to fail, but the second one works, However then
when I do a call to
do_CreateInstance(NS_WEBBROWSER_CONTRACTID, &rv); It always fails, which is
probably related to what you wrote below.

However when I include that code in my project I get linker errors trying to
find NS_GetComponentRegistrar. Any ideas?
currentyly I'm linking in :
embed_base_s.lib
nspr4.lib
profdirserviceprovider_s.lib
xpcomglue.lib
plc4.lib
plds4.lib

and have my preprocessor set to
XP_WIN32
XP_WIN

I took Niky's advice and recompiled Mozilla with
ac_add_options --disable-static
ac_add_options --enable-shared

Thanks,
--Richard

"Olaf" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
I solved my FACTORY error by using the piece of code mentioned at:

http://www.mozilla.org/projects/embedding/embedapiref/ embedapi2.html#1099700

The part about automatic component discovery (first block of code). Put
it before your Init call



_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

_______________________________________________
dev-embedding mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-embedding

Reply via email to