简体   繁体   English

如何检测是否在Windows Metro应用程序进程中运行?

[英]How to detect if running inside Windows Metro application process?

I am developing a library and I would like to be able to detect if it is running inside Metro style application to selectively disable/enable some functionality. 我正在开发一个库,并且希望能够检测它是否在Metro风格应用程序中运行,以有选择地禁用/启用某些功能。 Is it possible? 可能吗?

You can use the IMetroMode interface to check if your library has been loaded inside a Metro-style application. 您可以使用IMetroMode接口检查您的库是否已在Metro风格的应用程序中加载。 Call the GetMonitorMode() method, if pMode will hold MMM_METRO then you'll be sure you're running inside a Metro application. 调用GetMonitorMode()方法,如果pMode将保留MMM_METRO则可以确保在Metro应用程序中运行。

Here is a simple test: 这是一个简单的测试:

if (WinJS) {
    // WinJS exists in global if in WinRT app
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM