Very stupid question... how to determine, what kind of windows user has? W95/98/NT/2000/NET?
I know GetVersion and GetVersionEx, but they return major version - the problem is both W95 and W98 have major version 4.
Printable View
Very stupid question... how to determine, what kind of windows user has? W95/98/NT/2000/NET?
I know GetVersion and GetVersionEx, but they return major version - the problem is both W95 and W98 have major version 4.
I'm sure there is an API to do this, but VB also has the SysInfo Control that gives you the Major/Minor revison info:
Code:Private Sub Form_Load()
Debug.Print SysInfo1.OSVersion
Debug.Print SysInfo1.OSPlatform
Debug.Print SysInfo1.OSBuild
End Sub
Not sure how old this is and if it get's ME..but it's the API version and should give the general scope of things.Code:Private 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
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
Private Const VER_PLATFORM_WIN32_NT = 2
Private Const VER_PLATFORM_WIN32_WINDOWS = 1
Public Function GetWindowsVersion() As String
Dim os As OSVERSIONINFO
Dim strVersion As String
Dim strSP As String
os.dwOSVersionInfoSize = Len(os)
os.szCSDVersion = Space(255)
Call GetVersionEx(os)
With os
Select Case .dwPlatformId
Case VER_PLATFORM_WIN32_WINDOWS
If .dwMinorVersion = 0 Then
strVersion = "Windows 95"
ElseIf .dwMinorVersion = 10 Then
strVersion = "Windows 98"
End If
Case VER_PLATFORM_WIN32_NT
If .dwMajorVersion = 3 Then
strVersion = "Windows NT 3.51"
ElseIf .dwMajorVersion = 4 Then
strVersion = "Windows NT 4.0"
ElseIf .dwMajorVersion = 5 Then
strVersion = "Windows 2000"
End If
strSP = Trim(.szCSDVersion)
End Select
strVersion = strVersion & vbCrLf & .dwMajorVersion & "." & .dwMinorVersion & "." & .dwBuildNumber
strVersion = strVersion & vbCrLf & strSP
End With
GetWindowsVersion = strVersion
End Function
Private Sub Form_Load()
MsgBox GetWindowsVersion
End Sub