在写WinCE程序时,经常要针对不同的版本写不同的代码,如何在预编译时判断WinCE的版本呢?
可使用如下语句判断
//===============
//判断WinCE版本号
#if (_WIN32_WCE == 211)
//Your code;
#endif
#if (_WIN32_WCE >= 200)
//Your code;
#endif
#if (_WIN32_WCE < 300)
//Your code;
#endif
//=============
//判断WinCE与PC
#if defined(_WIN32_WCE)
//Your code;
#endif
//==============
判断Palm Size PC
#if defined(_WIN32_WCE_PSPC)
//Your code;
#endif
//=============
//判断Pocket PC
if defined(WIN32_PLATFORM_PSPC)
// Pocket PC or Palm Size PC
#if (WIN32_PLATFORM_PSPC == 1)
// Pocket PC 2000
#elif (WIN32_PLATFORM_PSPC == 310)
// Pocket PC 2002
#else
// Some other Pocket PC
#endif
//=============
//判断模拟器
#ifdef _WIN32_WCE_EMULATION
//Your code;
#endif
//=============
//判断HPC
#if defined(WIN32_PLATFORM_HPC2000)
// H/PC 2000
#elif defined(WIN32_PLATFORM_HPCPRO)
// H/PC Pro
#endif
//=============
//判断SmartPhone
#if defined(WIN32_PLATFORM_WFSP)
// Smartphone
#endif
//=============
//判断CPU类型
#if defined(ARM)
// ARM processor
#elif defined (MIPS)
// MIPS processor
#elif defined (SH3)
// SH3 processor
#elif defined (SH4)
// SH4 processor
#elif defined (x86)
// x86 processor - emulator version
#else
// 其它
#endif