Article ID: 140484
Article Last Modified on 1/19/2007
'====================================
' 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"
Case VER_PLATFORM_WIN32_NT
PlatformName = "Windows NT"
End Select
MsgBox "Platform: " & PlatformName & vbCrLf & _
"Version: " & WindowsVersion & vbCrLf & _
"Build: " & BuildVersion
End Function?SysVersions32()
Additional query words: Win95
Keywords: kbhowto kbprogramming KB140484