Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

System idle time

System idle time

System idle time

Is there a way I can find out how long the system has been idle?  I need a process to run in the background while the system is idle.  An example would be FindFast.  How do they index your hard drive only when the system is able, or how does windows start screen savers when the system has been idle for a period of time?

~BenDilts( void )

RE: System idle time

It is possible to set a timer to signal you when
no action (i.e. no keyboard input and no mouse move)
has happened in a given time , and to re-set it each time
such input arrives. That is the screen-saver way.
Another question is to "know" when the system is idle.
You can set the priority of the background task to the lowest, so it will be given CPU time only when no other task is waiting to CPU. There is no need to "know" when
the system is idle for that purpose.
If your application wants to perform some job on the background, you can use the WM_IDLE (or something like that)
message sent when no other messages are in the queue (note, however, this does not mean that some thread of the process is not doing CPU-crunching without getting window messages !

It depends what you want to acheive, so use one or more of the above methods.
Good Luck


RE: System idle time

How do you set such a timer?

RE: System idle time

Use either SetTimer for coarse time-measure (up to 55 msesc i think) or something like SetWaitableTimer for more
precise and thread-oriented approach


RE: System idle time

You may also want to check our the SetPriorityClass API function. If you set the priority class of your process/thread as IDLE_PRIORITY_CLASS, it will only run when the system is idle.

RE: System idle time

How to check if the system is idle is not(no mouse movements and no keystrokes)?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close