[Solved] Retrieving OO version (OO + VB6)

Java, C++, C#, Delphi, ??? - Using the UNO bridges

[Solved] Retrieving OO version (OO + VB6)

Postby Tenebroleso » Tue Aug 21, 2012 4:21 pm

Hi all,

is it possible to retrieve the version of OO installed using API? Which API can I use?

Thank you!
Last edited by RoryOF on Tue Aug 21, 2012 5:43 pm, edited 1 time in total.
Reason: Marked [Solved] and added green tick. [RoryOF, Moderator]
OpenOffice 3.4 on Windows XP
Tenebroleso
 
Posts: 15
Joined: Thu Jul 05, 2012 2:58 pm

Re: Retrieving OO version (OO + VB6)

Postby Villeroy » Tue Aug 21, 2012 4:36 pm

Code: Select all   Expand viewCollapse view
Function getOOoVersion() As String

  getOOoVersion = getOOoSetupValue("/org.openoffice.Setup/Product","ooSetupVersion")
end Function
Function getOOoSetupNode(sNodePath$)
Dim aConfigProvider, oNode, args(0) As new com.sun.star.beans.PropertyValue
   aConfigProvider = createUnoService("com.sun.star.configuration.ConfigurationProvider")
   args(0).Name = "nodepath"
   args(0).Value = sNodePath
   getOOoSetupNode = aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args())
End Function
Function getOOoSetupValue(sNodePath$,sProperty$)
Dim oNode
   oNode = getOOoSetupNode(sNodePath)
   getOOoSetupValue = oNode.getbyname(sProperty)
End Function
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28676
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Retrieving OO version (OO + VB6)

Postby Tenebroleso » Tue Aug 21, 2012 5:00 pm

I have found this code too and have tried to convert to VB6 but seems not to work.

This is why I'm here asking VB6 code. ;)
OpenOffice 3.4 on Windows XP
Tenebroleso
 
Posts: 15
Joined: Thu Jul 05, 2012 2:58 pm

Re: Retrieving OO version (OO + VB6)

Postby RoryOF » Tue Aug 21, 2012 5:08 pm

OpenOffice does not use VB6 code. Mastering the OpenOffice API is much more complex
Apache OpenOffice 4.1.7 on Xubuntu 20.04.1 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
RoryOF
Moderator
 
Posts: 31565
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Retrieving OO version (OO + VB6)

Postby Villeroy » Tue Aug 21, 2012 5:22 pm

Of course you can do the same in VB6 if you know how to create the UNO service to read configuration data. If you do not know how to do that, then you can not do much with UNO without a constant flow of other people's code snippets.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.4
User avatar
Villeroy
Volunteer
 
Posts: 28676
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Retrieving OO version (OO + VB6)

Postby Tenebroleso » Tue Aug 21, 2012 5:26 pm

Solved.

Code: Select all   Expand viewCollapse view
Public Function VersionOO(oServiceManagerLav As Object, oDesktopLav As Object) As String
    Dim oConfigProvider As Object
    Dim oSettings       As Object
    Dim oArguments(0)   As Object
   
    Set oConfigProvider = oServiceManagerLav.createInstance("com.sun.star.configuration.ConfigurationProvider")
   
    Set oArguments(0) = oServiceManagerLav.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
    oArguments(0).Name = "nodepath"
    oArguments(0).Value = "/org.openoffice.Setup/Product"
   
    Set oSettings = oConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", oArguments())
   
    VersionOO = oSettings.getByName("ooSetupVersion")
End Function
OpenOffice 3.4 on Windows XP
Tenebroleso
 
Posts: 15
Joined: Thu Jul 05, 2012 2:58 pm


Return to External Programs

Who is online

Users browsing this forum: No registered users and 1 guest