Sample client

"RL Clippard" <[email protected]>
Newsgroups gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Does anyone have a sample C++ program that uses
"@mozilla.org/rdf/datasource;1?name=window-mediator". At this point I would
not even be that picky - any C++ program that successfully uses a standard
Netscape XPCOM component would be nice.

Does  "nsResult = NS_InitXPCOM2(nsnull, nsnull, nsnull);" have to supply the
directory to the Netscape components or does it 'know'? Also my version of
Netscape (6.2) xpcom.dll does not allow NS_InitXPCOM2() - I assumed this is
just a minor issue so I am using the xpcom.dll that came with mozilla.9.9.

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

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

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

//-initXPCOM
     nsIServiceManager *serviceManager=0;
     nsResult = NS_InitXPCOM2(&serviceManager, componentPath, nsnull);
// This fails! ---> 0x80004005
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.