问:在写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_WCE_PSPC) && (_WIN32_WCE >= 300) //Your code; #endif //=============判断模拟器 #ifdef _WIN32_WCE_EMULATION //Your code; #endif
|