Introduction
This project was coded to detect Windows OS version. It can detect more than 65 different versions of Windows OSs.
Using the Code
You can place the code into any form you want or you can get rid of the objects Text1
, Command1
and modify the code to paste in module.
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(lpVersionInformation As OSversionInfo) As Long
Private Type OSversionInfo
OSVersionInfoSize As Long
MajorVersion As Long
MinorVersion As Long
BuildNumber As Long
PlatformId As Long
szCSDVersion As String * 128
End Type
Private Type OSversionInfoX
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
wServicePackMajor As Integer
wServicePackMinor As Integer
wSuiteMask As Integer
wProductType As Byte
wReserved As Byte
End Type
Public Function DetectOSversion() As String
On Error Resume Next
Dim OS As OSversionInfo
Dim durum As Boolean
Dim Version As String
OS.OSVersionInfoSize = Len(OS)
durum = GetVersionEx(OS)
Version = OS.MajorVersion & "." & OS.MinorVersion & "." & OS.BuildNumber
Select Case Version
Case "4.00.950"
DetectOSversion = "Windows 95 OEM Service Release 1 (95A)"
Case "4.00.1111"
DetectOSversion = "Windows 95 OEM Service Release 2 (95B)"
Case "4.03.1212"
DetectOSversion = "Windows 95 OEM Service Release 2.1"
Case "4.03.1214"
DetectOSversion = "Windows 95 OEM Service Release 2.5 C"
Case "4.10.1998"
DetectOSversion = "Windows 98"
Case "4.10.2222"
DetectOSversion = "Windows 98 Second Edition (SE)"
Case "4.90.2476"
DetectOSversion = "Windows Millenium Beta"
Case "4.90.3000"
DetectOSversion = "Windows Millenium"
Case "3.10.528"
DetectOSversion = "Windows NT 3.1"
Case "3.50.807"
DetectOSversion = "Windows NT 3.5"
Case "3.51.1057"
DetectOSversion = "Windows NT 3.51"
Case "4.00.1381"
DetectOSversion = "Windows NT 4.00"
Case "5.00.1515"
DetectOSversion = "Windows NT 5.00 (Beta 2)"
Case "5.00.2031"
DetectOSversion = "Windows 2000 (Beta 3)"
Case "5.00.2128"
DetectOSversion = "Windows 2000 (Beta 3 RC2)"
Case "5.00.2183"
DetectOSversion = "Windows 2000 (Beta 3)"
Case "5.00.2195"
DetectOSversion = "Windows 2000"
Case "2250.."
DetectOSversion = "Whistler Server Preview"
Case "2257.."
DetectOSversion = "Whistler Server alpha"
Case "2267.."
DetectOSversion = "Whistler Server interim release"
Case "2410.."
DetectOSversion = "Whistler Server interim release"
Case "5.1.2505"
DetectOSversion = "Windows XP (RC 1)"
Case "5.1.2600"
DetectOSversion = "Windows XP SP[1, 2, 3]"
Case "5.1.1105"
DetectOSversion = "Windows XP, Service Pack 1"
Case "5.1.1106"
DetectOSversion = "Windows XP, Service Pack 1"
Case "5.1.2180"
DetectOSversion = "Windows XP, Service Pack 2"
Case "5.2.3541"
DetectOSversion = "Windows .NET Server interim"
Case "5.2.3590"
DetectOSversion = "Windows .NET Server Beta 3"
Case "5.2.3660"
DetectOSversion = "Windows .NET Server Release Candidate 1 (RC1)"
Case "5.2.3718"
DetectOSversion = "Windows .NET Server 2003 RC2"
Case "5.2.3763"
DetectOSversion = "Windows Server 2003 (Beta?)"
Case "5.2.3790"
DetectOSversion = "Windows Server 2003, [SP1, Home]"
Case "5.2.1180"
DetectOSversion = "Windows Server 2003 Service Pack 1"
Case "5.2.1218"
DetectOSversion = "Windows Server 2003"
Case "6.0.5048"
DetectOSversion = "Windows Longhorn"
Case "6.0.5112"
DetectOSversion = "Windows Vista, Beta 1"
Case "6.0.5219"
DetectOSversion = "Windows Vista, Community Technology Preview (CTP)"
Case "6.0.5259"
DetectOSversion = "Windows Vista, TAP Preview"
Case "6.0.5270"
DetectOSversion = "Windows Vista, CTP (Dezember)"
Case "6.0.5308"
DetectOSversion = "Windows Vista, CTP (Februar)"
Case "6.0.5342"
DetectOSversion = "Windows Vista, CTP (Refresh)"
Case "6.0.5365"
DetectOSversion = "Windows Vista, April EWD"
Case "6.0.5381"
DetectOSversion = "Windows Vista, Beta 2 Previw"
Case "6.0.5384"
DetectOSversion = "Windows Vista, Beta 2"
Case "6.0.5456"
DetectOSversion = "Windows Vista, Pre-RC1"
Case "6.0.5472"
DetectOSversion = "Windows Vista, Pre-RC1, Build 5472"
Case "6.0.5536"
DetectOSversion = "Windows Vista, Pre-RC1, Build 5536"
Case "6.0.5600"
DetectOSversion = "Windows Vista, RC1"
Case "6.0.16384"
DetectOSversion = "Windows Vista, RC1"
Case "6.0.5700"
DetectOSversion = "Windows Vista, Pre-RC2"
Case "6.0.5728"
DetectOSversion = "Windows Vista, Pre-RC2, Build 5728"
Case "6.0.5744"
DetectOSversion = "Windows Vista, RC2"
Case "6.0.16384"
DetectOSversion = "Windows Vista, RC2"
Case "6.0.5808"
DetectOSversion = "Windows Vista, Pre-RTM, Build 5808"
Case "6.0.5824"
DetectOSversion = "Windows Vista, Pre-RTM, Build 5824"
Case "6.0.5840"
DetectOSversion = "Windows Vista, Pre-RTM, Build 5840"
Case "6.0.6000"
DetectOSversion = "Windows Vista"
Case "6.0.16386"
DetectOSversion = "Windows Vista, RTM (Release to Manufacturing)"
Case "6.0.6002"
DetectOSversion = "Windows Vista, Service Pack 2"
Case "6.0.6001"
DetectOSversion = "Windows Server 2008"
Case "6.1.7600"
DetectOSversion = "Windows 7, RTM \ Server 2008 R2, RTM (Release to Manufacturing)"
Case "6.1.16385"
DetectOSversion = "Windows 7, RTM (Release to Manufacturing)"
Case "6.1.7601"
DetectOSversion = "Windows 7 \ Server 2008 R2, SP1"
Case "6.1.16385"
DetectOSversion = "Windows Server 2008 R2, RTM (Release to Manufacturing)"
Case "6.1.8400"
DetectOSversion = "Windows Home Server 2011"
Case "6.2.9200"
DetectOSversion = "Windows 8 \ Server 2012"
Case "6.2.10211"
DetectOSversion = "Windows Phone 8"
Case Else
DetectOSversion = "Unknown OS Ver[" & Version & "]"
End Select
End Function
Private Sub Command1_Click()
Text1.Text = DetectOSversion
End Sub
History
- 5th October, 2013: Initial post