|
发表于 2008-5-20 18:27:33
|
显示全部楼层
可以为系统的Application.OnIdle事件赋值,
具体请参考delphi帮助:
TApplication.OnIdle
Occurs when an application becomes idle.
type TIdleEvent = procedure (Sender: TObject; var Done: Boolean) of object;
property OnIdle: TIdleEvent;
Description
Write an OnIdle event handler to perform special processing when an application is idle. An application is idle when it is not processing code. For example, an application is idle when it is waiting for input from the user.
The TIdleEvent type is the type of the OnIdle event. TIdleEvent has a Boolean parameter Done that is True by default. When Done is True, the application allows all action components to update themselves after the OnIdle event handler returns. After updating the actions, the application calls the Windows API WaitMessage, which yields control to other applications until a new message appears in the message queue of the application. When Done is False, the application actions do not receive an OnUpdate event and the application does not yield control to other applications while it is not busy.
OnIdle is called only once, as the application transitions into an idle state. It is not called continuously unless Done is set to False. Applications that set Done to False consume an inordinate amount of CPU time, which affects overall system performance.
Note: You can also respond to this event using the TApplicationEvents component, which allows you to assign an event handler using the IDE. |
|