OO-Snippets: Get Windows Version

Commons

Keywordswindows version, get version
LanguageOOBasic
ApplicationOffice
AuthorsDorange-Pattoret Didier (initial)
Supported Versions
Supported OS
Question How do I get the Windows Version?
Answer

You have to read the version information from the windows registry

Code-Snippet-Listing (snippet-source)

Public Const HKEY_LOCAL_MACHINE = &H80000002

    Sub VersionValue
        Dim sVersion as String
        Globalscope.BasicLibraries.LoadLibrary("ImportWizard")
        OpenRegKey(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\")
        sVersion = _ QueryValue(HKEY_LOCAL_MACHINE,"Software\\Microsoft\\Windows\\CurrentVersion\\","ProductName")
        
        If sVersion <> "" Then
            Print sVersion
        Else
            OpenRegKey(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows_ NT\\CurrentVersion\\")
            sVersion = QueryValue(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows_ NT\\CurrentVersion","ProductName")
            Print sVersion
        EndIf
    End Sub

Changelog

DateUserModification
0000-00-00ddpInitial version

and