In fact they are seperable.
In Module
In FormCode:Option Explicit
Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' Maintenance string for PSS usage.
End Type
Public Const VER_PLATFORM_WIN32s = 0
Public Const VER_PLATFORM_WIN32_WINDOWS = 1
Public Const VER_PLATFORM_WIN32_NT = 2
Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Code:Private Sub Command1_Click()
SysVersions32
End Sub
Function SysVersions32()
Dim v As OSVERSIONINFO, retval As Long
Dim WindowsVersion As String, BuildVersion As String
Dim PlatformName As String
v.dwOSVersionInfoSize = Len(v)
retval = GetVersionEx(v)
WindowsVersion = v.dwMajorVersion & "." & v.dwMinorVersion
BuildVersion = v.dwBuildNumber And &HFFFF&
Select Case v.dwPlatformId
Case VER_PLATFORM_WIN32_NT
If v.dwMajorVersion <= 4 Then
PlatformName = "Microsoft Windows NT "
ElseIf v.dwMajorVersion = 5 Then
PlatformName = "Microsoft Windows 2000 "
End If
Case VER_PLATFORM_WIN32_WINDOWS
If v.dwMajorVersion > 4 Or _
(v.dwMajorVersion = 4 And v.dwMinorVersion > 0) _
Then
PlatformName = "Microsoft Windows 98 "
Else
PlatformName = "Microsoft Windows 95 "
End If
Case VER_PLATFORM_WIN32s
PlatformName = "Microsoft Win32s "
End Select
MsgBox "Platform: " & PlatformName & vbCrLf & _
"Version: " & WindowsVersion & vbCrLf & _
"Build: " & BuildVersion
End Function
