Hello, Benjamin.

Thank you for ur mail.

spiGestorDownload is declared like this on first example:

nsCOMPtr<nsIDownloadManager> spiGestorDownload;

and like this on the second one

nsCOMPtr <nsISupports> spiGestorDownload;


I think the type of the smart pointer matches the IID I am passing on second parameter.

This is a XPCOM component.

And I am linking it against these libraries
nspr4.lib plds4.lib embedstring.lib xpcomglue.lib plc4.lib


I also use The GetServiceByContractID() method to obtain a pointer to other component services like the Doc Loader Service (@mozilla.org/docloaderservice;1) and it works with no problem...

The do_GetService() call doesn't call the nsIServiceManager::GetService() internally?
Anyway I 'll try this new pattern and see what happens.

Again, thank you for your help

Oliveiros



----- Original Message ----- From: "Benjamin Smedberg" <[EMAIL PROTECTED]>
Newsgroups: netscape.public.mozilla.xpcom
To: <>
Sent: Monday, January 16, 2006 5:19 PM
Subject: Re: Failure to obtain the download manager component


Oliveiros Cristina wrote:
I have already tried to use the nsIServiceManager::GetService() method using the CID {0xedb0490e, 0x1dd1 , 0x11b2, {0x83, 0xb8, 0xdb, 0xf8 , 0xd8, 0x59, 0x06, 0xa6}}. But unfortunately the there were no improvements....

Your code snippet is not large enough to help diagnose the problem. What type is "spiGestorDownload"? What linking strategy are you using? If you're using the standalone glue, have you called XPCOMGlueStartup() successfully?

unRetVal = spiServManager -> GetServiceByContractID("@mozilla.org/download-manager;1",

NS_GET_IID(nsIDownloadManager),

getter_AddRefs(spiGestorDownload));



I have already tried to call it this way unRetVal = spiServManager -> GetServiceByContractID("@mozilla.org/download-manager;1",

NS_GET_IID(nsISupports),

getter_AddRefs(spiGestorDownload));

The typical pattern is nsCOMPtr<nsISomeInterface> myptr = do_GetService("@mozilla.org/contractid");

This pattern ensures that the NS_GET_IID matches the type of the comptr.

--BDS
_______________________________________________
Mozilla-xpcom mailing list
Mozilla-xpcom@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-xpcom


_______________________________________________
Mozilla-xpcom mailing list
Mozilla-xpcom@mozilla.org
http://mail.mozilla.org/listinfo/mozilla-xpcom

Reply via email to