5
votes

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
Surely can't be true that once opened an app cannot be closed.David Heffernan
There is no UI action besides Alt+F4 to close the Metro-style application. I believe this is by design. you can DL the OS at dev.windows.com and try it yourself.Glenn Ferrie
OK, so you can close the app then!David Heffernan
true. i'm more concerned with the Metro-style to .NET4 interaction. This is just a sample app to frame it. any ideas?Glenn Ferrie
You can move the pointer to the top of the window until is turns into a flat hand and then drag the app to the bottom, or just swipe with touch interface. This part of the drap/swipe to snap and task swap.rob

4 Answers

8
votes

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.

8
votes

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.

3
votes

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

-1
votes

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.