Compartilhar via


GetVersionEx (Windows CE 5.0)

Send Feedback

This function obtains extended information about the version of the OS that is currently running. CeGetVersionEx is the RAPI version of this function.

BOOLGetVersionEx( LPOSVERSIONINFOlpVersionInformation);

Parameters

  • lpVersionInformation
    [out] Pointer to an OSVERSIONINFO data structure that the function fills with OS version information.

    Before calling the GetVersionEx function, set the dwOSVersionInfoSize member of the OSVERSIONINFO data structure to sizeof(OSVERSIONINFO).

Return Values

Nonzero indicates success. Zero indicates failure.

To get extended error information, call GetLastError. The function fails if you specify an invalid value for the dwOSVersionInfoSize member of the OSVERSIONINFO.

Remarks

When using the GetVersionEx function to determine whether your application is running on a particular version of the OS, check for version numbers that are greater than or equal to the version numbers you want.

This verification ensures that the test succeeds for later versions of the OS. For example, you could use the following code example if your application requires Windows 98.

GetVersionEx (&osvi);
bIsWindows98orLater = 
   (osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) &&
   ( (osvi.dwMajorVersion > 4) ||
   ( (osvi.dwMajorVersion == 4) && (osvi.dwMinorVersion > 0) ) );

Identifying the current OS is usually not the best way to determine whether a particular OS feature is present. This is because the OS may have had new features added in a redistributable dynamic-link library (DLL).

Rather than using GetVersionEx to determine the OS or version number, test for the presence of the feature itself.

To determine the best way to test for a feature, refer to the documentation for the feature you want.

The following list discusses some common techniques for feature detection:

  • You can test for the presence of the functions associated with a feature.

    To test for the presence of a function in a system DLL, call the LoadLibrary function to load the DLL. Then call the GetProcAddress function to determine whether the function of interest is present in the DLL.

    Use the pointer returned by GetProcAddress to call the function. Even if the function is present, it may be a stub that just returns an error code such as ERROR_CALL_NOT_IMPLEMENTED.

  • You can determine the presence of some features by using the GetSystemMetrics function. For example, you can detect multiple display monitors by calling GetSystemMetrics(SM_CMONITORS).

  • There are several versions of the redistributable DLLs that implement shell and common control features.

The value of the dwPlatformID member of the OSVERSIONINFO structure will be VER_PLATFORM_WIN32_CE.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib.

See Also

CeGetVersionEx (RAPI) | GetProcAddress | GetSystemMetrics | LoadLibrary | OSVERSIONINFO

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.