1

I want to write a Windows 8 Metro App which starts automatically after the user's login.

For desktop apps I know how to do that, using a registry key or copying a link to the startup folder. In this case I am looking for a Metro equivalent to the last approach. Because I want the user to can easily remove it.

How can I link to my (or any) Metro App to put the link in the startup folder or something like this?

(By the way, the system should show the Metro start screen and not my app to the user first. But he should be able to select the app from the active apps tab (left charm) any time he want.)

danijar
  • 32,406
  • 45
  • 166
  • 297

1 Answers1

5

This is not possible. Even if you can start it on startup [1], the app would get suspended in the background anyway. additionally, all metro apps show a splashscreen when started.

What is it that you are trying to achieve? If its to run code, background tasks will do this, and do not require your app to start to be kicked off.

If its to get in the MRU list, then this is auto managed but the system, and even if your app is there, it can be terminated, and aged out of the list at anytime.

If you don't want to create a separate launch mechanism, you can register a protocol handler - eg. Myapp://stuff - and open that using standard ShellExecute functions to start your application.

Note, you cannot bundle this application and have it placed in the startup group from an appx package. It has to be delivered out of band from the appx itself. Additionally, you cannot stop the splash screen being displayed.

[1] since you are also asking to do something that you cannot do in package with win 8 store apps, you can create another exe which can use the supported APIs to launch the metro app. Placing this app in the startup group will have the behavior you want. The API you need it: http://msdn.microsoft.com/en-us/library/windows/desktop/Hh706903(v=vs.85).aspx

Dominic Hopton
  • 7,262
  • 1
  • 22
  • 29
  • 1
    Just curious, what is the API that the desktop app can call to launch the Metro app? I was looking for this but never found it. – Jared Bienz - MSFT Aug 14 '12 at 14:43
  • @JaredBienz-MSFT. The solution to this would be a solution to my answer as well. – danijar Aug 14 '12 at 15:03
  • What I want to achieve is, that the user would "be able to select the app from the active apps tab (left charm) any time". Slide in from the left screen side on a Windows 8 (preview) system to show this active apps list. – danijar Aug 14 '12 at 15:06
  • You cannot force it to be in that list. It will be pushed out as soon as the user uses N other apps, your app will pushed off. It's just not possible. If the user is USING your app regularly it will automatically show up in the list. – Dominic Hopton Aug 14 '12 at 18:25
  • 1
    There are two ways to launch a metro app: URL, which is declared in the manifesting you get to choose the protocol. There IS a COM interface for activating a Metro app, which takes the package name. However, I can't find it. To be clear, it will STILL cause the splash screen to show. – Dominic Hopton Aug 14 '12 at 18:31
  • Could you please give me some more informations about starting a metro app so that I can do a little research about it? You could also edit your answer and it will be appcepted then. It isn't important (and wanted) that the app stays forever in the list but it must be there after boot. – danijar Aug 15 '12 at 20:52
  • Or is there any simple way the user could do to register an app for autostart? It seems like you can't link a *.lnk to a metro app, can you? – danijar Aug 15 '12 at 20:53
  • 2
    Updated. I still think you shouldn't be trying to do this - it goes against the metro experience. The app, if the user uses it, is only one movement away, on the start page. – Dominic Hopton Aug 15 '12 at 22:27
  • Finally back at work, and have the API link: http://msdn.microsoft.com/en-us/library/windows/desktop/Hh706903(v=vs.85).aspx – Dominic Hopton Aug 22 '12 at 18:38