Purpose |
The GetVersionEx function obtains extended information about the version of the operating system that is currently running. |
Library | Transcribed by | Date of page | Updated on |
Kernel32.dll | J.Paris | 13.03.03 |
Restrictions on use |
none |
Declare 32-bit |
Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (   lpVersionInformation As OSVERSIONINFO ) As Integer |
Required Type definition |
OSVERSIONINFO |
Parameters | |
lpVersionInformation | Pointer to an OSVERSIONINFO data structure that the function fills with operating system version information.
Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of the OSVERSIONINFO data structure to sizeof(OSVERSIONINFO)=148 |
Return value |
If the function succeeds, the return value is nonzero. If the function fails, the return value is zero. |
Example |
Type OSVERSIONINFO dwOSVersionInfoSize As IntegerdwMajorVersion As Integer dwMinorVersion As Integer dwBuildNumber As Integer dwPlatformId As Integer szCSDVersion As String * 128 End Type
Declare Function GetVersionEx Lib "kernel32.dll" Alias "GetVersionExA" (lpVersionInformation As OSVERSIONINFO ) As Integer
Dim os As OSVERSIONINFO ' receives version information Dim retval As Integer ' return value 0=error occurred, 1=successful
os.dwOSVersionInfoSize = 148 ' calculated size of the OSVERSIONINFO type retval = GetVersionEx(os) ' read Windows's version information
'sample of ouput Note "Windows version number: "+ str$(os.dwMajorVersion)+ "."+str$(os.dwMinorVersion) +chr$(10)+os.szCSDVersion |
Comments |
See also |