How to detect the windows platform version?

Hi,session.Platform (in lotusscript) returns the operating system platform like “Windows/16” or “Windows/32”.

How can I detect more info about the windows version?something like “Microsoft Windows XP [version 5.1.2600]”.

Subject: How to detect the windows platform version?

Have you checked the Win32 API’s ?

The GetVersionEx is probably what you want.

Found the stuff below on the net, haven’t tested but should work.

Type OSVERSIONINFO

dwOSVersionInfoSize As Long

dwMajorVersion As Long

dwMinorVersion As Long

dwBuildNumber As Long

dwPlatformId As Long

szCSDVersion As String * 128

End Type

Declare Function GetVersionEx Lib “kernel32” Alias “GetVersionExA” (lpVersionInformation As OSVERSIONINFO) As Long

Dim lOSVer As Long

Dim lVer As OSVERSIONINFO

Dim dblSize As Double

lVer.dwOSVersionInfoSize = Len(lVer)

dblSize = GetVersionEx(lVer)

lOSVer = lVer.dwPlatformId

Subject: RE: How to detect the windows platform version?

Hi Kenneth,Yes, I checked API’s … but did not found the good one.

You pointed me to the GetVersionEx.

Thanks!

Your code did not work, but searching for more info on the net, I found this to work:

Type OSVERSIONINFO

dwOSVersionInfoSize As Long

dwMajorVersion As Long

dwMinorVersion As Long

dwBuildNumber As Long

dwPlatformId As Long

szCSDVersion As String * 128    'Everything after this member is part of the newest structure

wServicePackMajor As Integer

wServicePackMinor As Integer

wSuiteMask As Integer

bProductType As Byte

bReserved As Byte	

End Type

Declare Function GetVersionEx Lib “kernel32” Alias “GetVersionExA” (lpVersionInformation As OSVERSIONINFO) As Long

Dim lOSVer As Long

Dim lVer As OSVERSIONINFO

Dim dblSize As Double

lVer.dwOSVersionInfoSize = 148 'Len(lVer)

dblSize = GetVersionEx(lVer)

lOSVer = lVer.dwPlatformId

On XP, it even returns the service pack level!

Thanks again.