The component manager and the service manager interfaces are implemented by the same object. You can QI between the two without any problems (versions >1.1 this will work fine.)

I haven't looked at the NS_WITH_SERVICE macro in a long time and I believe it has been removed from the mozilla trunk.

Doug Turner
[EMAIL PROTECTED]


Tom Lee wrote:
Hello, I have written a DLL and have an XUL interface for a Netscape
toolbar. I have a few problems with Documentation on Mozilla. For one thing
the "NSRegisterSelf" examples do not compile - and there are several
examples all over the web that show how to incorporate the self registration
logic - they all do not compile. I believe this functionality shown below is
obsolete. I am looking for help to show me how to connect  my XPCOM dll to
the Netscape XUL toolbar. The main problem is the NS_WITH_SERVICE macro. No
matter what I do is seems to be a problem. Is there a NEW example somewhere
that shows me how to integrate an XPCOM DLL with XUL. Any help would be
greatly apreciated

    nsCOMPtr<nsIServiceManager> servMgr(do_QueryInterface(aServMgr, &rv));
    if (NS_FAILED(rv)) return rv;

    NS_WITH_SERVICE(nsIComponentManager, compMgr, kComponentManagerCID,
&rv);
    if (NS_FAILED(rv)) return rv;

...

    rv = compMgr->RegisterComponent(kCutCID,
                                    "My Toolbar",
                                    "component://netscape/bla",
                                    aPath, PR_TRUE, PR_TRUE);

if (NS_FAILED(rv)) return rv;






Reply via email to