|
-
Nov 25th, 2001, 10:05 AM
#1
versions again
I found the following code but when I run it on a windows ME machine, it tells me that windows 98 is the operating system.
Private Declare Function GetVersionEx Lib "kernel32" Alias "GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long
Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128
End Type
Public Const VER_PLATFORM_WIN32s = 0
Public Const VER_PLATFORM_WIN32_WINDOWS = 1
Public Const VER_PLATFORM_WIN32_NT = 2
Public Sub GetVersionInformation()
Dim OSInfo As OSVERSIONINFO
Dim lngRetVal As Long
Dim PId As String, tmpStrInfo As String
OSInfo.dwOSVersionInfoSize = Len(OSInfo)
lngRetVal = CLng(GetVersionEx(OSInfo))
If lngRetVal = 0 Then MsgBox "Error Getting Version Information": Exit Sub
Select Case OSInfo.dwPlatformId
Case VER_PLATFORM_WIN32_NT
' This is an NT version (NT/2000)
' If dwMajorVersion >= 5 then
' the OS is Win2000
If OSInfo.dwMajorVersion >= 5 Then
PId = "Windows 2000"
Else
PId = "Windows NT"
End If
Case Else
' This is Windows 95/98/ME
If OSInfo.dwMajorVersion >= 5 Then
PId = "Windows ME"
ElseIf OSInfo.dwMajorVersion = 4 And OSInfo.dwMinorVersion > 0 Then
PId = "Windows 98"
Else
PId = "Windows 95"
End If
End Select
tmpStrInfo = "OS: " & PId & vbCrLf
tmpStrInfo = tmpStrInfo & "Windows version:" & _
CStr(OSInfo.dwMajorVersion) + "." & _
LTrim(CStr(OSInfo.dwMinorVersion)) & vbCrLf
tmpStrInfo = tmpStrInfo & "Build: " + CStr(OSInfo.dwBuildNumber) & vbCrLf _
& OSInfo.szCSDVersion
'MsgBox tmpStrInfo, , "System Statistics"
OsVersion = PId
End Sub
Please point me towards the Major and Minor version numbers.
Thanx
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|