codice:
Option Explicit
Public Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
    (ByRef lpVersionInformation As OSVERSIONINFO) As Long
Public Type OSVERSIONINFO
    dwOSVersionInfoSize As Long
    dwMajorVersion As Long
    dwMinorVersion As Long
    dwBuildNumber As Long
    dwPlatformId As Long
    szCSDVersion As String * 128
End Type

Public Const VER_PLATFORM_WIN32s = 0
Public Const VER_PLATFORM_WIN32_WINDOWS = 1
Public Const VER_PLATFORM_WIN32_NT = 2
Public Function ShowWinVersion(vLabel As Label)
    Dim version As OSVERSIONINFO
    Dim strPlatform As String
    version.dwOSVersionInfoSize = Len(version)
    GetVersionEx version
    If version.dwPlatformId = 1 And version.dwMinorVersion = 10 And LoWord(version.dwBuildNumber) = 1998 Then
        strPlatform = "Microsoft Windows 98 "
    ElseIf version.dwPlatformId = 1 And version.dwMinorVersion = 10 And LoWord(version.dwBuildNumber) = 2222 Then
        strPlatform = "Microsoft Windows 98 SE "
    ElseIf version.dwPlatformId = 1 And version.dwMinorVersion = 90 And LoWord(version.dwBuildNumber) = 3000 Then
        strPlatform = "Microsoft Windows ME "
    ElseIf version.dwPlatformId = 1 And version.dwMinorVersion = 0 And LoWord(version.dwBuildNumber) = 950 Then
        strPlatform = "Microsoft Windows 95 "
    ElseIf version.dwPlatformId = 1 And version.dwMinorVersion = 0 And LoWord(version.dwBuildNumber) = 1111 Then
        strPlatform = "Microsoft Windows 95B "
    End If
    
    If version.dwPlatformId = 2 And version.dwMajorVersion = 3 Then
        strPlatform = "Microsoft Windows NT 3.51 "
    ElseIf version.dwPlatformId = 2 And version.dwMajorVersion = 4 Then
        strPlatform = "Microsoft Windows NT "
    ElseIf version.dwPlatformId = 2 And version.dwMajorVersion = 5 Then
        strPlatform = "Microsoft Windows 2000 "
    End If
    
    strPlatform = strPlatform & "v" & Format(version.dwMajorVersion) & "." & _
        Format(version.dwMinorVersion) & " (Build " & LoWord(version.dwBuildNumber) & ")"
    
    vLabel.Alignment = 2
    vLabel.BackStyle = 0
    vLabel.Caption = strPlatform
End Function

Private Function LoWord(lngIn As Long) As Integer
    If (lngIn And &HFFFF&) > &H7FFF Then
        LoWord = (lngIn And &HFFFF&) - &H10000
    Else
        LoWord = lngIn And &HFFFF&
    End If
End Function

' Sul Form
sub Form_Load()
    ShowWinVersion Label1
end sub