Click here to Skip to main content
Click here to Skip to main content

Tagged as

Windows OS Version Detector

, 5 Oct 2013
Rate this:
Please Sign up or sign in to vote.
Windows OS Version Detector, detects more than 65 different versions of Windows OS

Windows OS Version Detector

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.

'#######################################
'##                                   ##
'##  Coded by Farid Alkorashy         ##
'##  www.facebook.com/FaridAlkorashy  ##
'##  Windows OS Version Detector      ##
'##                                   ##
'#######################################

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

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
AnswerRe: try this PinmemberFarid Alkorashy10-Apr-14 6:35 
Questiontry this PinmemberYusuf Arapoglu11-Mar-14 10:57 
QuestionRe: Bug PinmemberFarid Alkorashy6-Oct-13 7:00 
BugBug PinmemberMehdiNaseri6-Oct-13 3:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140814.1 | Last Updated 5 Oct 2013
Article Copyright 2013 by Farid Alkorashy
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid