![[poke] [poke] [poke]](/data/assets/smilies/poke.gif)
Here's what I use:
'********************
'* OS VERSION
'********************
Public Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Public Declare Function GetVersionExA Lib "kernel32" _
(lpVersionInformation As OSVERSIONINFO) As Integer
Public Function GetWindowsVersion() As String
' Purpose: Find Windows version
On Error GoTo ErrHandler
Dim strOSName As String
Dim OSInfo As OSVERSIONINFO
OSInfo.dwOSVersionInfoSize = 148
OSInfo.szCSDVersion = Space$(128)
' API call to get operating system info.
Call GetVersionExA(OSInfo)
With OSInfo
Select Case .dwPlatformId
Case 1
Select Case .dwMinorVersion
Case 0
strOSName = "Windows 95"
Case 10
strOSName = "Windows 98"
Case 90
strOSName = "Windows Millennium"
End Select
Case 2
Select Case .dwMajorVersion
Case 3
strOSName = "Windows NT 3.51"
Case 4
strOSName = "Windows NT 4.0"
Case 5
If .dwMinorVersion = 0 Then
strOSName = "Windows 2000"
Else
strOSName = "Windows XP"
End If
End Select
Case Else
strOSName = "Failed"
End Select
End With
GetWindowsVersion = strOSName
ExitHere:
Exit Function
ErrHandler:
Call LogError("Module: modSystem", "GetWindowsVersion( )", Err, Err.Description)
Resume ExitHere
End Function
VBSlammer