How to check Windows Edition?

icyman

Member
Joined
Feb 16, 2005
Messages
6
Programming Experience
1-3
I've been struggling to check for Windows Edition with vb.net....
i.e. Home Edition, Profession Edition, TabletPC Edition
I noticed that to check the operating system version, I can use Environment.OSVersion.ToString (it'll give me Windows NT 5.1.2600.0 where "Windows 5.1" represents XP....and that the 2600 and 0 stays the same even if I'm in a different edition)
Can someone give me a help?
Thanks a lot.
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
well here's a function that'll return what type of windows you have (win3.11, 95,98,98se,me,nt4,2000,xp,2003) but not which type of xp (home, pro, corp pro) anywho here's what i got:

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
 

icyman

Member
Joined
Feb 16, 2005
Messages
6
Programming Experience
1-3
I found the answer to the question!

Thanks JuggaloBrotha first of all.

While continuously searching on the net, I found this useful piece of code:
PublicEnum SystemMetric AsInteger

TabletPC = 86

EndEnum

And with this function call I can check whether it's a tabletPC:
GetSystemMetrics(SystemMetric.TabletPC) <> 0

This if the actual function...it's from the user32 library:

Declare
Auto Function GetSystemMetrics Lib "User32" _
(
ByVal index As SystemMetric) As Integer

 
Last edited:

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
i'll have ta add that to the function then, thanx

edit:
what namespace is GetSystemMetrics apart of?
 
Last edited:
Top Bottom