GetVersionEx Function

Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long

Platforms: Win 32s, Win 95/98, Win NT

GetVersionEx reads information about the version of Windows running as the operating system. This information includes the strict version number and platform (3.x with Win32s, Windows 95, Windows NT, Windows 98, etc.). The information is put into the variable passed as lpVersionInformation. The function returns 0 if an error occured, or a 1 if successful.

lpVersionInformation
Receives the version information for the operating system.

Example:

' Display the major and minor version numbers of Windows.
' For example, 4.0 could represent Windows 95.
Dim os As OSVERSIONINFO  ' receives version information
Dim retval As Long  ' return value

os.dwOSVersionInfoSize = Len(os)  ' set the size of the structure
retval = GetVersionEx(os)  ' read Windows's version information
Debug.Print "Windows version number:"; os.dwMajorVersion; "."; os.dwMinorVersion

Category: System Information
Back to the index.


Go to Paul Kuliniewicz's Home Page.
E-mail: rogue953@hotmail.com
This page is at http://skyscraper.fortunecity.com/transmission/45/api/g/getversionex.html