I need to perform some file operations on WinCE platform. The paths of file differ in Device compared to Emulator. So i need to choose file according to the environment, like below.
#if define开发者_JS百科d(WINCE_EMULATOR) //This macro is just for illustration
#define path ".\Storage Card\\1.txt" //Emulator configuration
#else
#define path "\\My Documents\Storage Card\\1.txt" //Device configuration
#endif
Is there any macro to differentiate between WinCE emulator and WinCE device ?
There isn't a macro to check this, and couldn't be - the compiler has no idea what target you're going to run on. You have to do a run-time check using something like SystemParametersInfo with SPI_GETOEMINFO and look for emulator-specific text (IIRC it returns something like "Microsoft DeviceEmulator").
精彩评论