Accessing other processes in Win8 Metro-style app

2019-03-29 12:17发布

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).

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.

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.

CLARIFICATION: I am less concerned with this specific application than I am with access that type of .NET functionality within a Metro-style app

Thanks

4条回答
做自己的国王
2楼-- · 2019-03-29 12:24

Don't waste too much time on this. I expect that in a beta a close option (perhaps even a charm) will be included. Until then use a keyboard Alt-F4 or the Task Manager

查看更多
一纸荒年 Trace。
3楼-- · 2019-03-29 12:41

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

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.

查看更多
对你真心纯属浪费
4楼-- · 2019-03-29 12:43

C++:

Window::Current->CoreWindow->Close();

or

Window::Current->Close();

I haven't explored the difference between these two (more precisely, I don't know how CoreWindow differs from Current. I could assume though...

I'm using an Oracle VBox with Win8 on my Win7 machine to develop a C++ Metro App using VS 11. I used both of the above methods. I verified in Task Manager the app was not running on both Win8 and the Simulator.

查看更多
forever°为你锁心
5楼-- · 2019-03-29 12:44

From what I understand (watching Build2011 videos) a Metro App won't be able to do that...

Interaction between processes is severally limited to specific Contracts (the charms on the right: Search, Send-to).

Think Phone, not Desktop.

You might be able to build a non-Metro Win8 app though.

查看更多
登录 后发表回答