Predefined Macro To identify UWP RRS feed

  • Question

  • Hi,

    in my cpp code (cross platform program).

    how to detect windows UWP specific part.

    #if defined (__linux__)

    #include <unistd.h>
    #include <sys/time.h>
    #include <termios.h>
    #include <fcntl.h>
    #include <conio.h>
    #include <process.h>



    Monday, July 24, 2017 3:12 AM

All replies

  • Hi Kaliraj.vi

    There is a file that contains all the macros defined for UWP app. It is a “winapifamily.h” header in Windows 10 SDK. It is a part of the SDK and it is installed in the shared include file directory. For example:

    C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared\winapifamily.h

    You could find the macros you need in this file and use them to reach your goal.

    Best Regards


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, July 25, 2017 6:38 AM
  • If defined, WINAPI_FAMILY will indicate which API partition is being used. If it's not defined, you can assume it's a desktop app.

    // Windows Store or Universal Windows Platform
    // Win32 desktop app

    To determine if it's a Windows 8.0 Store app, a Windows 8.1 Store app, or a Universal Windows Platform app, use the traditional _WIN32_WINNT value. Keep in mind that if you are building against the Windows 8.1 SDK, then _WIN32_WINNT_WIN10 won't be defined and will default to 0, so you would need to compare with the literal value to be sure it works:

    #if _WIN32_WINNT >= 0x0A00
    // Windows 10 and/or Universal Windows Platform

    To consume Windows Runtime APIs, you need to use either C++/CX (a.k.a. the /ZW switch), WRL, or C++/WinRT. To detect the /ZW case, you can check for the existence of __cplusplus_winrt to know if you are building with /ZW.

    See Dual-use Coding Techniques for Games

    Thursday, July 27, 2017 7:10 AM