当操作系统完成加载其所有的应用程序\services时如何以编程方式检测? [英] How to detect programmatically when the OS has done loading all of its applications\services?

查看:296
本文介绍了当操作系统完成加载其所有的应用程序\services时如何以编程方式检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑:我改写了我的问题,请忽略以下所有评论(截至5月7日)。



,我将尝试解释这个问题:

我的进程是尝试使用ITrayDeskBand :: ShowDeskBand以编程方式显示一个Deskband。

它在任何时候都很好,除非当操作系统正在加载其所有进程(复位或注销后)。



Windows启动并开始加载各种应用程序\services后,鼠标光标设置为等待几秒钟(取决于运行的应用程序数量)一切都是多快)。



如果鼠标光标设置为等待,并且进程在此期间运行,则调用将失败。

但是,如果我的进程等待几秒钟(在那段时间之后,游标变得正常),然后调用调用,一切工作伟大。



此行为在Windows 7和Windows Vista上重现。



所以基本上我要问的是:



当游标设置为忙碌时,操作系统会执行吗?

2)更重要的问题:当此过程结束时如何以程序方式检测? >

首先,我认为explorer没有正确加载,所以我使用 WaitForInputIdle 但它不是它。



后来我认为忙碌的光标指示CPU正忙,所以我使用 IDLE_PRIORITY_CLASS 创建了我的进程

如果 ITrayDeskBand :: ShowDeskBand c $ c>失败,然后等待 TaskbarCreated 消息,然后重试。 (这是通知图标使用的相同技术。)


Edit: I rephrased my question, please ignore all of the comments below (up to the 7th of May).

First off, I'll try to explain the problem:
My process is trying to show a Deskband programmatically using ITrayDeskBand::ShowDeskBand.
It works great at any time except for when the OS is loading all of its processes (after reset or logout).

After Windows boots and starts loading the various applications\services, the mouse cursor is set to wait for a couple of seconds (depends on how many applications are running \ how fast everything is).

If the mouse cursor is set to wait and the process is running during that time, the call will fail.
However, if my process waits a few seconds (after that time the cursor becomes regular) and then invokes the call, everything works great.

This behavior was reproduced both on Windows 7 and Windows Vista.

So basically what I'm asking is :

1) Just for basic knowledge, What the OS does when the cursor is set to busy?
2) The more important question : How can i detect programmatically when this process is over?

At first, I thought that explorer hadn't loaded properly so I've used WaitForInputIdle but it wasn't it.

Later I thought that the busy cursor indicates that the CPU is busy so I've created my process using IDLE_PRIORITY_CLASS but idle times were received while the cursor was busy.

解决方案

If ITrayDeskBand::ShowDeskBand fails, then wait for the TaskbarCreated message and then try again. (This is the same technique used by notification icons.)

这篇关于当操作系统完成加载其所有的应用程序\services时如何以编程方式检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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