Every time Microsoft releases a new version of Windows CE, there are changes to the available APIs. Most of the time there are additions of new APIs, but sometimes an API becomes obsolete and rarely an API changes signatures. If you are like me, you probably want to maintain as little source code as possible. That means that the code needs to compile under the different versions while taking advantage of new features.
Bldver.h provides a way to check for the Windows CE version at compile time. Bldver.h is simple; it just defines a few version macros. The macros define the major and minor version. These can be checked at compile time to include or exclude source code. Bldver.h defines:
·         CE_MAJOR_VER – defines the major OS version.
·         CE_MINOR_VER – defines the minor OS version. The minor version is in 100ths, so the minor version for Windows CE 4.2 is 20.
Bldver.h is included in the SDK, so it can be used both with Platform Builder and with Visual Studio or eMbedded Visual C++.
Examples:
#if CE_MAJOR_VER > 5
// Some code that will be built for Windows CE 6.0 and later versions
#endif
 
#if CE_MAJOR_VER < 6
// Some code that will be built for Windows CE 5.0 and previous versions
#endif
 
#if (CE_MAJOR_VER == 4 && CE_MINOR_VER > 10) || CE_MAJOR_VER > 4)
// Some code that will be built for Windows CE 4.2 and later versions
#endif
 
Copyright © 2009 – Bruce Eitman
All Rights Reserved