Monthly Archives: February 2013

Get a future proof user friendly operating system version in VB6

To get a user friendly, future proof, operating system version in VB6 code use the WMI classes like this:

Public Function GetFriendlyOSVersion() As String
        Dim query As String
        query = "SELECT Caption FROM Win32_OperatingSystem"
        Dim results As Object
        Set results = GetObject("Winmgmts:").ExecQuery(query)
        Dim info As Object
        For Each info In results
            GetFriendlyOSVersion = info.Caption
        Next info
    End Function