views:

30

answers:

1

Hi, 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 defined(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 ?

+2  A: 

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").

ctacke
@ctacke: Is there any OS macro like OS_WINXP or OS_WINMOBILE ?
bjskishore123
There are macros like UNDER_CE, WIN32_PLATFORM_PSPC, and WIN32_PLATFORM_WFSP.
ctacke