自动启动Metro应用 [英] Auto Startup a Metro App

查看:84
本文介绍了自动启动Metro应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个Windows 8 Metro应用程序,该应用程序在用户登录后自动启动.

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

对于桌面应用程序,我知道如何使用注册表项或将链接复制到启动文件夹的方法.在这种情况下,我正在寻找一种等同于最后一种方法的Metro.因为我希望用户可以轻松删除它.

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.

如何链接到我的(或任何)Metro应用程序,以将链接放入启动文件夹或类似的文件中?

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

(顺便说一句,系统应该首先向用户显示Metro的开始屏幕,而不是我的应用程序.但是,他应该能够随时在活动的应用程序选项卡中选择应用程序(左超级键).)

(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]时启动它,该应用也仍然会在后台挂起.此外,所有Metro应用在启动时都会显示启动画面.

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.

如果要进入MRU列表,则可以对其进行自动管理,但是系统(即使您的应用程序在那里)也可以终止,并且可以随时退出列表.

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.

如果您不想创建单独的启动机制,则可以注册协议处理程序-例如. Myapp://stuff-并使用标准ShellExecute函数将其打开以启动您的应用程序.

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.

请注意,您不能捆绑此应用程序并将其从appx包中放入启动组中.它必须从appx本身带外交付.此外,您无法停止显示初始屏幕.

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]因为您还要求使用Win 8商店应用程序打包做一些您不能做的事情,所以您可以创建另一个可以使用受支持的API来启动Metro应用程序的exe.将此应用放置在启动组中将具有您想要的行为.您需要的API: http: //msdn.microsoft.com/zh-CN/library/windows/desktop/Hh706903(v=vs.85).aspx

[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

这篇关于自动启动Metro应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆