This article was previously published under Q210200
Advanced: Requires expert coding, interoperability, and multiuser skills.
Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.
View products that this article applies to.
'====================================
' Global Declarations
'====================================
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
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_WINDOWS
PlatformName = "Windows 95/98"
Case VER_PLATFORM_WIN32_NT
PlatformName = "Windows NT"
End Select
MsgBox "Platform: " & PlatformName & vbCrLf & _
"Version: " & WindowsVersion & vbCrLf & _
"Build: " & BuildVersion
End Function
?SysVersions32()
Keywords: KB210200, kbprogramming, kbhowto