|
-
Feb 25th, 2003, 08:53 PM
#1
Thread Starter
Frenzied Member
Determine What OS
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?
~Peter

-
Feb 25th, 2003, 09:33 PM
#2
Member
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
-
Feb 25th, 2003, 10:00 PM
#3
Thread Starter
Frenzied Member
That works nice. Thanks.
Now if we could find a way to determine if it was WinXP Pro versus Home, that would be cool.
~Peter

Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|