Auto Startup a Metro App

て烟熏妆下的殇ゞ 提交于 2019-12-02 10:04:45

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/11942006/auto-startup-a-metro-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!