AGAIN: questions swt + mozilla

jml <[email protected]> Fri, 20 Dec 2002 15:51:57 +0800
Newsgroups gmane.comp.mozilla.devel.java,gmane.comp.mozilla.devel.embedding,gmane.comp.mozilla.devel.xpcom
Organization Another Netscape Collabra Server User
Message-ID <[email protected]>
Had some question posted several days ago, but not getting any answer, 
so repost them again.

I am having some fun trying to combine swt and mozilla (xpcom) together, 
  I achieved in making the following java code to run:

public static void main(String[] args) {
     Embed.NS_InitEmbedding(0,0);
     nsIComponentRegistrar registrar = Embed.getComponentRegistrar();
     nsISimpleEnumerator enum = registrar.enumerateContractIDs();
     int count = 0;
     while( enum.hasMoreElements()) {
         nsISupports s = enum.getNext();
         nsISupportsCString cstring = 
(nsISupportsCString)s.queryInterface(nsISupportsCString.class);
         s.Release();
         System.out.println(cstring.toString());
         cstring.Release();
     }
     Embed.NS_TermEmbedding();
}

It give me a list of registered components:
@mozilla.org/persistent-properties;1
@mozilla.org/file/local;1
@mozilla.org/supports-PRUint64;1
......

But there is no
"@mozilla.org/embedding/browser/nsWebBrowser;1"

1. I am using a default mozilla 1.2.1 installation (that is I downloaded 
from mozilla web site, and unzipped to C:\mozilla). What do I need to do 
to make the webbrowser component to be auto registered?

2. For the nsISupportsCString.toString() method, I receive a "string" 
pointer, do I need to call any method to release the memory associated 
with it? If yes, which method should I call? 
NS_GetMemoryManager.free(ptr)? I tried this, but seemed it do not return 
NS_OK.

3. How can I get the nsIStringService service object? I want to use it 
to do nsAString -->wstring (nsACString --> string) conversion. Then I 
needn't implement nsAString and nsACString in my native code.


Thanks

jml