Quick tip: Killing a Metro-style app in Windows 8

Metro-style apps are very similar to Windows Phone apps. They have a similar application model (for example they can be suspended, and when suspended they can be killed by the operating system if memory is needed), so they need to maintain state. Also, and that is the topic of this post, they cannot be ended by the user in a “normal” way, i.e. there is no File / Exit menu and no “X” button in the corner. Once started, the application remains in memory until the following happens:

  • The app is in suspended mode (not in the foreground) and the system needs to reclaim the RAM.
  • The advanced user starts the Task manager, locates the application and kills the process.

Note: Unfortunately I cannot illustrate this with a picture, because my Task Manager refuses to run more than 2 seconds for some unknown reason. Windows 8 is a preview release (TM).

However sometimes you need to kill a Metro style app, because Visual Studio will refuse to start a second instance if the first one is still running. You will get an error message like the following:

So should you use the task manager?

Well thankfully you don’t have to use the task manager (which is a blessing since, as I mentioned, mine keeps crashing all the time). Instead, just navigate to the application in question with Alt-Tab, and then press Alt-F4. This is a quick and easy way to euthanize your app and start a fresh new one in Studio later.

Update: The excellent and always vigilant Tim Heuer just told me that the Alt-F4 tip only applies to Windows 8 running with a developer license. No Alt-F4 for non coders, it seems Smile

Of course, pressing Alt-F4 requires you to have a real keyboard, since the on screen keyboard does not have any function key (nor the Alt key for that matter). But honestly, who writes code without a real keyboard anyway (I mean, except me when I am in bed and REALLY REALLY want to try something out).

Cheers,

Laurent

 

Print | posted on Sunday, September 25, 2011 11:16 PM

Feedback

# re: Quick tip: Killing a Metro-style app in Windows 8

left by Ward Bell at 9/27/2011 7:40 AM Gravatar
Want to use the keyboard but don't have a physical keyboard. There's an app for that! It's the native Windows "On-Screen Keyboard" app! PSK is an accessibility feature.

You can search for it (use the Search charm) among the "Apps" and pin it for easy access (can also launch in Desktop ... and it stays on top when you nav back to Metro.

With "On-Screen Keyboard" on top, to kill the app, (1) touch on the app to close (2)touch Fn (3) touch Alt, (4) touch F4.

Close OSK by touching its close box.

The OSK is typically more useful for entering Function keys.

# re: Quick tip: Killing a Metro-style app in Windows 8

left by Laurent at 9/27/2011 6:37 PM Gravatar
Hey Ward, nice tip! I had no idea about this OSK app. Good to know :)

Cheers,
Laurent

# re: Quick tip: Killing a Metro-style app in Windows 8

left by Pierre Morel-Fourrier at 10/10/2011 5:00 AM Gravatar
If you are in Visual Studio, press Shift+F5 (Debug/Stop debugging) to kill the Metro app you're working on.

# re: Quick tip: Killing a Metro-style app in Windows 8

left by Pontus Wittenmark at 11/28/2011 2:12 AM Gravatar
You can also tell VS to automatically kill it on every build. Just add this in your project's build event:

TASKKILL /F /IM "$(TargetFileName)" /FI "STATUS eq RUNNING"

Been using this baby since way back when and it still works :)
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: