Marc,
That macro does it exactly. It works (in my tests) on 1.1.3 and
2.0beta(aka 1.9.79).

In my java test's I try getting the DefaultRegistry but line (3) in
my code snippet below returns null (resulting of course in an NPE on
line 4). Any one know why?

Is this even a 'best practice' of dealing with this issue?

thanks,
mike 

-------------------- Code Snippet --------------------
1. Object oSimpleRegistry = xMCF.createInstanceWithContext(
2.         "com.sun.star.registry.DefaultRegistry", xContext); 
  
3. XSimpleRegistry registry = (XSimpleRegistry)
UnoRuntime.queryInterface(com.sun.star.registry.XSimpleRegistry.class,
oSimpleRegistry);

4. XRegistryKey root = registry.getRootKey();
XRegistryKey org = root.openKey("org");
XRegistryKey openoffice = org.openKey("openoffice");
XRegistryKey setup = openoffice.openKey("Setup");
XRegistryKey product = setup.openKey("Product");
String[] products = setup.getStringListValue();
System.out.println("products.length='"+products.length+"'");
for (int i=0; i<products.length; i++) {
    System.out.println("product["+i+"]='"+products[i]+"'");
}
-------------------- Code Snippet --------------------



--- Marc Santhoff <[EMAIL PROTECTED]> wrote:
> Am Mi, den 06.04.2005 schrieb Mike Traum um 18:33:
> > My understanding is that when using the Bootstrap, you cannot
> detect
> > what version of OOo you're connected to.
> > 
> > So, what is the best practice when you're using services that
> have
> > been newly (or even not so newly) added to the api?
> [...]
> 
> A long time ago (for Version 1.0.3) I wrote this macro (sorry for
> long
> lines), which reads out a registry key showing the version number
> of
> OOo. Maybe the key is located elsewhere now, but it shows the
> principle.
> If you could tanslate this to java it would do the job.
> 
> Sub Main
>       GlobalScope.BasicLibraries.LoadLibrary("Tools") ' for
> GetRegistryKeyContent
>       
>       Dim oProdNameAccess as Object
>       Dim sProdName as String
>       oProdNameAccess =
> GetRegistryKeyContent("org.openoffice.Setup/Product")
>       
>       sProdName = oProdNameAccess.getByName("ooName")
>       sSetupVersion = oProdNameAccess.getByName("ooSetupVersion")
>       sSetupExtension = oProdNameAccess.getByName("ooSetupExtension")
>       msgbox sProdName + " : " + sSetupVersion + " : " + sSetupExtension
> 
> End Sub
> 
> HTH,
> Marc
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


                
__________________________________ 
Do you Yahoo!? 
Yahoo! Personals - Better first dates. More second dates. 
http://personals.yahoo.com


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to