GetVersionEx (Windows Embedded CE 6.0)
This function obtains extended information about the version of the OS that is currently running. CeGetVersionEx (RAPI) is the RAPI version of this function.
BOOL GetVersionEx( LPOSVERSIONINFO lpVersionInformation );
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.