[Solved] Retrieving OO version (OO + VB6)

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
Tenebroleso
Posts: 15
Joined: Thu Jul 05, 2012 2:58 pm

[Solved] Retrieving OO version (OO + VB6)

Post by Tenebroleso »

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
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Retrieving OO version (OO + VB6)

Post by Villeroy »

Code: Select all

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 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Tenebroleso
Posts: 15
Joined: Thu Jul 05, 2012 2:58 pm

Re: Retrieving OO version (OO + VB6)

Post by Tenebroleso »

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
User avatar
RoryOF
Moderator
Posts: 34613
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Retrieving OO version (OO + VB6)

Post by RoryOF »

OpenOffice does not use VB6 code. Mastering the OpenOffice API is much more complex
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Retrieving OO version (OO + VB6)

Post by Villeroy »

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 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Tenebroleso
Posts: 15
Joined: Thu Jul 05, 2012 2:58 pm

Re: Retrieving OO version (OO + VB6)

Post by Tenebroleso »

Solved.

Code: Select all

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
Post Reply