Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO) As Long
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 non-zero value if successful.
Example:
' Read the version number of Windows
Dim os As OSVERSIONINFO
os.dwOSVersionInfoSize = Len(os) ' set size of variable
x = GetVersionEx(os)
Debug.Print os.dwMajorVersion; "." os.dwMinorVersion
' For Windows 95, may print " 4 . 0"
Category: System Information
Back to the index.