Hello,
I'm (primitively) playing with xpcom and have the following simple program.
It seems that the registration of the component is taking place properly
but when I want to instantiate the service I receive "factory not registered"
or the error code 80040154. Can someone help me with this please.
int main(void) {
nsresult rv = NS_OK;
putenv("NSPR_LOG_MODULES=all:5");
putenv("NSPR_LOG_FILE=xpcom.log");
// Initialize XPCOM
rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(rv)) {
printf("ERROR: XPCOM intialization error [%x].\n", rv);
return -1;
}
// register all components in our default component directory
nsCOMPtr<nsIComponentRegistrar> registrar;
rv = NS_GetComponentRegistrar(getter_AddRefs(registrar));
if(NS_FAILED(rv)) {
NS_ShutdownXPCOM(nsnull);
return rv;
}
rv = registrar->AutoRegister(nsnull);
if(NS_FAILED(rv)) {
NS_ShutdownXPCOM(nsnull);
return rv;
}
NS_ENSURE_SUCCESS(rv, rv);
// Create an instance of our component
static NS_DEFINE_CID(kConfigServiceCID, XP_CONFIGSERVICE_CID);
nsCOMPtr<xpIConfigService> pConfigSvc = do_GetService(kConfigServiceCID, &rv);
if (NS_FAILED(rv))
{
printf("XP Config Service unavailable. Cannot continue [%x].\n", rv);
NS_ShutdownXPCOM(nsnull);
return rv;
}
...
...
}
_______________________________________________
Mozilla-xpcom mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-xpcom