Why wouldn't that work? Lookin at the error you get I'm guessing that the neccesary files could not be found. You have to supply the correct directory in some way (the dist/bin directory with the dll's and the subdirectories chrome, components etc). Also, if you use the correct initialization function you will not need to call NS_InitXPCOM2 or any other initialization function.
What went wrong when you tried the component manager? Did you get the component manager itself? Ixmal wrote: > I'm just trying to write a test application, the real one will be much > more > complicated and will include locating the path for installed GREs. I > will > try NS_InitEmbedding() as you suggest but I doubt if this will help > with > Firefox. > > Olaf wrote: > > Reading your code, you try to do all initialization yourself... If you > > know where > > the GRE is (as in your example) you can use NS_InitEmbedding() to > > initialize. But what if the user has installed it in another location? > > > > For your situation it may be better to read: > > http://developer.mozilla.org/en/docs/GRE > > Here is explained how to look for installed GRE's (there can be more > > than one version) and use one (the function > > GRE_GetGREPathWithProperties). > > > > [EMAIL PROTECTED] wrote: > > > I try to embed Mozilla browser into my application, but don't want to > > > distribute a Gecko Runtime with it. The solution I'm working on is to > > > use GRE installed on user's machine. For example, if there is a Mozilla > > > Firefox installed my app can use its GRE, if not - my app will not > > > support browser embedding. > > > > > > The problem is that when I'm linking to Mozilla's GRE everyting works > > > fine, while with Firefox' GRE I get an error NS_ERROR_FACTORY_NOT > > > REGISTERED. My code is like this: > > > > > > nsresult rv; > > > > > > rv = XPCOMGlueStartup("c:\program files\mozilla\firefox\xpcom.dll"); > > > if (NS_FAILED(rv)) > > > { > > > return; > > > } > > > > > > nsCOMPtr<nsILocalFile> binDir; > > > nsCString s("c:\program files\mozilla\firefox"); > > > NS_NewNativeLocalFile(s, TRUE, getter_AddRefs(binDir)); > > > > > > rv = NS_InitXPCOM2(nsnull, binDir, nsnull); > > > if (NS_FAILED(rv)) > > > { > > > return; > > > } > > > > > > nsCOMPtr<nsIComponentManager> compMan; > > > rv = NS_GetComponentManager(getter_AddRefs(compMan)); > > > if (NS_FAILED(rv)) > > > { > > > return; > > > } > > > > > > rv = compMan->CreateInstanceByContractID(NS_WEBBROWSER_CONTRACTID, > > > nsnull, NS_GET_IID(nsISupports), getter_AddRefs(mWebBrowser)); > > > if (NS_FAILED(rv)) > > > { > > > return; > > > } > > > > > > In the last statement I always get rv == > > > NS_ERROR_FACTORY_NOT_REGISTERED. I also tried to use > > > nsIComponentRegistrar, but had no success. > > > > > > I link my app with xpcomglue.lib, nspr4.lib, plc4.lib, plds4.lib and > > > string_s.lib from mozilla\dist\lib directory of Mozilla 1.7.13 build. > > > > > > Have anyone faced such a problem? _______________________________________________ dev-embedding mailing list [email protected] https://lists.mozilla.org/listinfo/dev-embedding
