C# - 如何知道Windows是"入驻"启动后? [英] C# - How to know when Windows is "settled" after startup?

查看:178
本文介绍了C# - 如何知道Windows是"入驻"启动后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写必须在Windows启动时运行的选项的应用程序。

I'm writing an application that will have an option to run on Windows Startup.

当应用程序陷入我的电脑下它确实之前,我受不了解决,这是一个非关键应用程序。我想我的应用程序礼貌地等待其它所有启动项来完成和解决,使用户的PC它开始做任何工作之前,将可以响应。

I can't stand when applications bog my PC down before it has really settled, and this is a non-critical application. I'd like my application to politely wait for all other startup items to finish and settle so that the user's PC becomes responsive before it starts doing any work.

我会怎样去检测这个条件?我想我可以遍历注册表,查找所有的启动进程正在运行,或使用一个稍长的计时器。我只是希望有另一种较少hackish的把戏我可以使用

How would I go about detecting this condition? I suppose I could traverse the registry and look for all startup processes to be running, or use a longish timer. I'm just hoping there is another less hackish trick I might use.

编辑:应用程序有一个用户界面,并不能作为服务运行。它有一个托盘模式。它做了一些图像渲染。

The application has a UI and cannot run as a service. It does have a tray mode. It does some image rendering.

推荐答案

一个长长的定时器是最好的途径。我不会触摸到注册表以bargepole。

A 'longish' timer is the best route. I wouldn't touch the registry with a bargepole.

你将要考虑的,虽然有一件事是,如果用户想发布您的计划本身会发生什么?显然,你不想被延误了呢。

One thing you will want to consider though is what happens if a user wants to launch your program themselves? Obviously you don't want to be causing the delay then.

我假设你的应用程序有一个用户界面?如果没有,你可以考虑服务与设置其启动类型为自动(延迟)在Vista / 7

I assume your application has a UI? If not, you could consider a Service with its start type set to "Automatic (Delayed)" on Vista/7

另请参阅此相关的问题:的How在C#创建延迟启动应用程序?

Please also see this related question: How to create delay startup application in c#?

最后一点,如果你的程序是不关键的,你担心它可能会放慢改革的步伐,考虑降低应用程序的优先级。

A final point, if your program is non-critical, and you are worried it might slow things down, consider lowering the priority of the application.

这篇关于C# - 如何知道Windows是"入驻"启动后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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