Detecting windows Vista

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,530
Location
Lansing, MI; USA
Programming Experience
10+
I have a function that returns what version of windows that the application is running on:
VB.NET:
    Friend Function GetOSVersion() As String
        Dim strVersion As String
        Select Case Environment.OSVersion.Platform
            Case PlatformID.Win32S
                strVersion = "Windows 3.1"
            Case PlatformID.Win32Windows
                Select Case Environment.OSVersion.Version.Minor
                    Case 0
                        strVersion = "Windows 95"
                    Case 10
                        If Environment.OSVersion.Version.Revision.ToString() = "2222A" Then
                            strVersion = "Windows 98 Second Edition"
                        Else
                            strVersion = "Windows 98"
                        End If
                    Case 90
                        strVersion = "Windows ME"
                    Case Else
                        strVersion = "Unknown"
                End Select
            Case PlatformID.Win32NT
                Select Case Environment.OSVersion.Version.Major
                    Case 3
                        strVersion = "Windows NT 3.51"
                    Case 4
                        strVersion = "Windows NT 4.0"
                    Case 5
                        Select Case Environment.OSVersion.Version.Minor
                            Case 0
                                strVersion = "Windows 2000"
                            Case 1
                                strVersion = "Windows XP"
                            Case 2
                                strVersion = "Windows 2003"
                        End Select
                    Case Else
                        strVersion = "Unknown"
                End Select
            Case PlatformID.WinCE
                strVersion = "Windows CE"
        End Select
        Return strVersion
    End Function

how can I add the detection of Windows Vista to this function?
 
Under PlatformID.Win32NT, major version 6. (according to this)
 
thanx, that link didn't show up in the search results when i looked for it on codeproject this morning, how did you come across it?
 
searched for "Environment.OSVersion Vista" I think.. :)
 
Back
Top