> i have a interface but just giving the path name of the IDL doesnt > work.....anyone there who can help me out????
if by path name you mean the path to the IDL file in the cvs source repository - that has no meaning at run-time. the authorative "identifier" for an interface (and for components as well by the way) is it's IID (interface id) e.g. http://lxr.mozilla.org/seamonkey/source/xpcom/ds/nsISimpleEnumerator.idl starts with [scriptable, uuid(D1899240-F9D2-11D2-BDD6-000064657374)] interface nsISimpleEnumerator : nsISupports { .. you see this HEX representation of a 128 bit number: D1899240-F9D2-11D2-BDD6-000064657374 that's the IID of the interface nsISimpleEnumerator. Now, in different languages, you have different ways of getting to it .. in Python, you can: >>> import xpcom >>> from xpcom import components >>> print components.interfaces['nsISimpleEnumerator'] {D1899240-F9D2-11D2-BDD6-000064657374} or just >>> print components.interfaces.nsISimpleEnumerator {D1899240-F9D2-11D2-BDD6-000064657374} in C++ you can: #include "nsISimpleEnumerator.h" nsresult rv = foo->QueryInterface (NS_GET_IID(nsISimpleEnumerator), (void**) enm); in JavaScript it work like so: <script> netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var sample = Components.classes["@mozilla.org/sample;1"].createInstance(); sample = sample.QueryInterface(Components.interfaces.nsISample); ... Tobias. generally, you'll may want to look at .. http://lxr.mozilla.org/seamonkey/source/xpcom/sample/xpconnect-sample.html there you'll find .. <script> /* to use nsSample.js version, use "@mozilla.org/jssample;1" */ netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var sample = Components.classes["@mozilla.org/sample;1"].createInstance(); sample = sample.QueryInterface(Components.interfaces.nsISample); dump("sample = " + sample + "\n"); function get() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var field = document.getElementById('Value'); field.value = sample.value; } function set() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var field = document.getElementById('Value'); sample.value = field.value; } function poke() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var field = document.getElementById('Value'); sample.poke(field.value); } function sampleWrite() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); sample.writeValue("here is what I'm writing: "); } </script> <form name="form"> <input type="button" value="Get" onclick="get();"> <input type="button" value="Set" onclick="set();"> <input type="button" value="Poke" onclick="poke();"> <input type="text" id="Value"> <input type="button" value="Write" onclick="sampleWrite();"> <form>
