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

查看:41
本文介绍了自动启动 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 商店应用程序包中无法执行的操作,您可以创建另一个 exe,它可以使用支持的 API 来启动 Metro 应用程序.将此应用程序放在启动组中将具有您想要的行为.您需要的 API:http://msdn.microsoft.com/en-us/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天全站免登陆