Does anyone have a sample C++ program that uses XPCOM to access a Netscape
service (specifically "@mozilla.org/rdf/datasource;1?name=window-mediator").
I need access to the current window of the top-most (active) Netscape
browser so I can tell it to go to another URL. I had initially tried this
via the DDE interface but there seems to be some problems with the Netscape
6 DDE implementation.

I have a basic question - do I have to tell XPCOM where to go to get its
components? Does "NS_InitXPCOM2(nsnull, nsnull, nsnull)" 'know' where to go
or do I have to tell it?

//-nsLocalFile
 nsCOMPtr<nsILocalFile> componentPath=0;
 componentPath = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID,&nsResult);

 const char *path = "C:\\Program Files\\Netscape\\Netscape 6";
 nsResult = componentPath->InitWithPath(path);

 PRBool isDirectory;
 nsResult = componentPath->IsDirectory(&isDirectory);
 printf("%s ---<%s>--- a directory\n",path,isDirectory?"IS":"IS NOT");

//-initXPCOM
// nsResult = NS_InitXPCOM2(nsnull, nsnull, nsnull);
// Fails (works if I comment out do_CreateInstance?)
 nsIServiceManager *serviceManager=0;
 nsResult = NS_InitXPCOM2(&serviceManager, componentPath, nsnull);
// Fails




Reply via email to