分享

c++

 quasiceo 2015-05-31

Is there a new macro to determine in code if the application is running on WinRT? As I'm working with LoadLibrary, it would be great if there is a macro to replace all calls to LoadLibrary with one to LoadPackagedLibrary...

I'm understanding the documentation correct as in I can load any DLL (as long as it's inside my package) via LoadPackagedLibrary, right?! (And as long as that DLL doesn't use black-listed APIs...)

asked Aug 14 '12 at 22:30
MFH
957823

    
You mean like #if NETFX_CORE? –  Filip Skakun Aug 14 '12 at 22:36
    
Sorry, I guess that's for .NET. Maybe for C++ you could use WINAPI_FAMILY –  Filip Skakun Aug 14 '12 at 22:40
    
Well as I'm currently using only the LoadLibrary-related stuff from <Windows.h>. So via #if WINAPI_FAMILY WINAPI_FAMILY_APP I can determine whether or not I'm on WinRT? –  MFH Aug 15 '12 at 0:06
    
Well, I have never done it, so I am not sure, but if it is your application - you should be able to tell yourself if it is a WinRT app or a WinAPI app. Unless you are asking about whether you are running on a Windows on Arm (WoA)/Windows RT tablet - then I have no idea how to check that. –  Filip Skakun Aug 15 '12 at 5:16
    
Well I want to have a generic code (it's already compatible with Windows and Linux, simply based on the platform dependent macros...) Now MS replaces LoadLibrary for WinRT but all other functions I use are still allowed... –  MFH Aug 15 '12 at 9:54

3 Answers

up vote 2 down vote accepted

I recently updated to Visual Studio 2012, and think I found the answer to my question:

Inside the Microsoft Headers the Macro WINAPI_FAMILY_PARTITION is used to determine the "Level" of WinAPI. Currently there are WINAPI_PARTITION_DESKTOP and WINAPI_PARTITION_APP, therefore I "guess" that via this macro one can differentiate between Desktop and Metro...

The two macros lead to another set of macros: #define WINAPI_FAMILY_APP WINAPI_PARTITION_APP and #define WINAPI_FAMILY_DESKTOP_APP (WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_APP). Therefore if WINAPI_FAMILY_APP is defined one should be able to assume that it's a Metro application...

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多