Known Issue - In Visual Studio, a Windows API is greyed out and I cannot access it even though it is a Windows Store Supported API. RRS feed

  • Question

  • I have noticed that some functions like CreateFile and LoadLibrary are now supported in Windows Store apps, but I still cannot access them in Visual Studio.  The functions are greyed out and un-callable.

    Friday, April 19, 2019 5:19 PM


  • With each release of Windows, we add more APIs to the Windows Store supported list.  Sometimes the Windows headers in the SDK you have installed have not caught up to the latest Windows Store list.  If this is the case, you can work around this anomaly by changing the partition specified by your app.

    For Individual Applications

    In this case, the easiest way to enable the APIs would be to add the following to the top of your pch.h file, or before all other includes which may define a different partition:

    #       include <winapifamily.h>

    #       define WINAPI_PARTITION_DESKTOP 1

    For Shared Code or Libraries

    In the event you need to enable this in a header that will be shared, then you should not override the define for the entire project.  Instead you should use the push and pop macros to change the partition just for your use. 

    Add the following at the top of your source file, before all other includes:


    #           pragma push_macro("WINAPI_PARTITION_DESKTOP")

    #           undef WINAPI_PARTITION_DESKTOP

    #           define WINAPI_PARTITION_DESKTOP 1


    #       endif

    Add the following to the end of your source file.


    #       pragma pop_macro("WINAPI_PARTITION_DESKTOP")

    #   endif

    For an implementation example, consider reviewing the source code snippet from the International Components for Unicode project:


    Please note: this change will enable your app to call more than those APIs supported by the Windows Store.  Calling unsupported APIs may result in test failures on Store submissions.  Therefore it is recommended that you verify your app with the App Certification Kit, prior to store submission.


    Friday, April 19, 2019 5:21 PM