在Win8 Metro风格的应用程序中访问其他进程

问题描述:

我正在尝试构建Windows 8都市风格"应用程序,该应用程序将充当应用程序杀手".对于使用Win8(技术预览版)的用户,您会注意到,一旦打开Metro风格的应用程序,便无法将其关闭(无需进入任务管理器并结束该过程).

I am trying to build a Windows 8 "metro-style" app that will operate as a "app killer". For those of you who have used Win8 (Tech Preview) you'll notice that once you open a metro-style app you cannot close it (without going into Task Manager and ending the process).

我的挑战是我无法从Metro风格的应用程序访问"System.Diagnostics.Process",也不知道WinRT中是否有可比的替代方案.我还考虑过构建一个单独的应用程序,该应用程序托管一个供我的Metro应用程序与之交互的服务,但我想使用一个应用程序来完成此操作.

My challenge is that I cannot access 'System.Diagnostics.Process' from my metro-style app, nor do I know if there is an comparable alternative within the WinRT. I also thought of building a separate app that hosts a service for my metro app to interface with, but I'd like to do this with a single app.

从根本上讲,我正在寻找一种构建利用.NET 4.0组件的Metro风格应用的模式,特别是能够枚举并杀死PC上运行的其他进程.

Fundamentally, I am looking for a pattern for building Metro-style apps that leverage .NET 4.0 components, specifically to be able to enumerate and kill other processes running on the PC.

说明:与在Metro风格的应用程序中访问该类型的.NET功能相比,我对此特定应用程序的关注程度较小

谢谢

对于您的特定问题,此功能不可用.应用程式不得与其他应用程式互动或干扰.

To your specific question, this functionality is not available. Apps are not allowed to interact or interfere with other apps.

为回答您的更一般的问题,与桌面应用程序相比,Metro风格应用程序可用的API受到限制. C#具有子集可用的.Net库,与Silverlight一样.对于C ++,子集可用.

To answer your more general question, the APIs available to Metro style applications is limited compared to what is available to desktop applications. C# has a subset of the .Net library available, much like Silverlight does. The same is true for C++ where a subset of the desktop Win32/COM APIs are available.