I have lots of good VB6 examples, but i haven't seen anything in .NET yet to help me determine what the operating system is that the user is running.
Anyone have a good way? :confused:
Printable View
I have lots of good VB6 examples, but i haven't seen anything in .NET yet to help me determine what the operating system is that the user is running.
Anyone have a good way? :confused:
Option Explicit On
Option Strict On
Imports System.Environment
Module modMain
Sub Main()
MsgBox(get_OS_Version)
End Sub
Public Function get_OS_Version() As String
Dim osInfo As OperatingSystem
osInfo = OSVersion
With osInfo
Select Case .Platform
Case .Platform.Win32Windows
Select Case (.Version.Minor)
Case 0
get_OS_Version = "Win95"
Case 10
If .Version.Revision.ToString() = "2222A" Then
get_OS_Version = "Win98 Second Edition"
Else
get_OS_Version = "Win98"
End If
Case 90
get_OS_Version = "WinMe"
End Select
Case .Platform.Win32NT
Select Case (.Version.Major)
Case 3
get_OS_Version = "WinNT351"
Case 4
get_OS_Version = "WinNT4"
Case 5
If .Version.Minor = 0 Then
get_OS_Version = "Win2K"
Else
get_OS_Version = "WinXP"
End If
End Select
Case Else
get_OS_Version = "Failed"
End Select
End With
End Function
End Module
That works nice. Thanks.
Now if we could find a way to determine if it was WinXP Pro versus Home, that would be cool.