次の方法で共有


Conditional Compilation

Send Feedback

Depending on which platform you are targeting at compile time, you can use conditional compilation to either include or exclude certain portions of code, as shown in the following code example.

Code Example

#ifdef WIN32_PLATFORM_PSPC
    // Pocket PC code.
#if (WIN32_PLATFORM_PSPC = 400)
    // Pocket PC 2003 code.
    LoadString(g_hInst, IDS_PPC2003, szBuf, MAX_LOADSTRING);
#elif (WIN32_PLATFORM_PSPC = 310)
    // Pocket PC 2002 code.
    LoadString(g_hInst, IDS_PPC2002, szBuf, MAX_LOADSTRING);
#endif 
#endif // WIN32_PLATFORM_PSPC

Remarks

Using a conditional compilation approach, as opposed to runtime platform and version checking, results in a separate executable file for each targeted platform.

See Also

Writing Code for Multiple Devices and Versions | Runtime Platform and Version Checking | How to: Implement Runtime Platform and Version Checking

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.