GetVersionEx() is a method for retrieving the Windows CE Version at runtime. The following function, OutputWindowsCEVersion(), demonstrates how to call GetVersionEx() and output the version information to the debug port.
Version.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
RETAILMSG(1, (TEXT("Windows CE %d.%d build %d\n"),
RETAILMSG( 1, (TEXT("Platform ID (%d) %s\n"),
Version.dwPlatformId, Version.dwPlatformId == VER_PLATFORM_WIN32_CE ? TEXT("Windows CE") : TEXT("Not Windows CE") ));
RETAILMSG( 1, (TEXT("(%s)\n"), Version.szCSDVersion ));
The output is broken into three separate calls for a reason. The first output uses the information in the OSVERSIONINFO structure that is of real value, the major and minor versions and the build number. The second line confirms that the OS is Windows CE, but since the application must be compiled for Windows CE if it is in C/C++ that isn’t so valuable, but if this function is used from managed code (C# or VB) this information is of value. And the last line doesn’t produce any results from szCSDVersion, that is there are no characters in the buffer on Windows CE 6.0.
Copyright © 2009 – Bruce Eitman
All Rights Reserved