Originally Posted by
Smart Programmer
Windows OS Version Detector is the best code I have seen ever which has the ability to detect more than 65 deferent types of windows versions. Programmed and developped by Farid Alkorashy.
You can read more and download the source code from CodeProject.com on the following link:
Source:
http://www.codeproject.com/Tips/6640...rsion-Detector
Well, in the code you linked to, there's "still some work to do" I'd say...
e.g. the longer TypeDefintion:
Code:
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
is just confusing - because it is not used anywhere in the example.
Also - from the way VB performs String-concatenations on (autoconverted) Long-Values, the following
List of Cases would fall through your detection:
Code:
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.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"
Olaf