DelphiFAQ Home Search:

When does Application.OnIdle() get executed?

 

commentsThis article has not been rated yet. After reading, feel free to leave comments and rate it.

Question:

I wanted to have some code executed within my application when a certain time has come (like a scheduler). I put the code to check current system time against that scheduled time in the OnIdle event but it does not always work. Why?

Answer:

The OnIdle event fires every time the application goes idle. It does not fire again until the application has done something and then goes idle again.

To do your scheduling, you will have to use a TTimer instance which you could have execute every minute (if you have multiple events scheduled; this is also known as a software timer as opposed to having tons of TTimer instances for all of your events).. or have your TTimer fire only once at exactly the time when your event is scheduled.

You could also look into WaitForMultipleObjects and WaitForSingleObject.


Comments:

 

 

NEW: Optional: Register   Login
Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option, or post under a registered account.
 

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity.
The owner of this web site reserves the right to delete such material.

photo Add a picture: