(Source: MSDN)
If you are targeting more than one Windows CE platform, but you still want to maintain a single source code, then you can either choose to develop against the least common denominator or work with #ifdef $(CePlatform) preprocessor define. This article will show you how to use this define most effectively.
Applies to:
Microsoft Windows Powered Pocket PC 2000
Microsoft eMbedded Visual C++
Pocket PC software development kit (SDK) or Handheld PC 2000 SDK (or any other Microsoft Windows CE SDK)
Gotchas
If you are using an SDK from any OEM that has an embedded device, then you have to fix an entry in the registry to get the key working correctly. Here is how:
- On your personal computer, type « Regedit » in the « Run … » dialog box of the Start menu.
- Locate the Registry key:HKLM\Software\Microsoft\Windows CE Tools\Platform Manager {F384D888-F9AA-11D1-BB9E-00A0C9C9CCEE}
Its default key should read « Platforms. »
- You will see a lot of globally unique identifiers (GUIDs) under that key. Each GUID represents one platform that is installed on your PC; for example, the GUID for Pocket PC is {6D5C6210-E14B-11D2-B72A-0000F8026CEE}. Unfortunately I cannot tell you the correct key of your OEM SDK, because it is different for all OEMs. You have to open them up one by one and look for a default key naming the platform of your OEM SDK.
- Open that key and you find again a series of GUIDs. The GUID we are looking for this time is {F384D894-F9AA-11D1-BB9E-00A0C9C9CCEE}. Its default value should read « Properties. »
- And again you will get a lot of GUIDs once you open the key above. This time you need to open all the keys to see which one is the right one. It should contain a key named « CEPlatform. »
- Rename the key « CePlatform. » Yes, you read correctly—the small « e » is actually what makes this key work. You actually have to rename it twice because RegEdit will not allow you to rename the key by just changing the big « E » to a small « e. » Rename the key « CeePlatform, » and then back to « CePlatform. »
The binary values of that key contain the Unicode string that the EVC compiler preprocessor is using as the $(CePlatform) replacement.