Click here to Skip to main content
15,909,199 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I have created a program in that i have to check that my computer is idle or not.if i didn't do any thing in my system for 5 seconds,now a message should be displayed that "your system is idle".for example i have opend ms word and typed some thing and i stop for five seconds,then the message "your system is idle" should come. how can i do this?I request your suggestion.

Thank you
Posted
Comments
Member 10595759 16-Feb-14 23:51pm    
how to check the system is idle or not using c# code?

Well there are several articles on this theme here:

Application Idle[^]
Getting the user idle time with C#[^]

Check them out and re-post if any.

Cheers
 
Share this answer
 
Comments
Manfred Rudolf Bihy 3-Feb-12 7:47am    
Nice links! 5+
Wrong wording here. What I garnered from you question you are not interested if the system is idle, but rather the person handling it. A system can well be under some mild stress and the person in front of it as inactive as you can imagine. So checking if the system is idle will not really help your here. If it is indeed the case that you want to check for "operator idleness" you could do so by adding a global mouse and keyboard hook to measure "activity". Caveat: Aside from legal issues arising from the monitoring of ones employees this system can just as easily defeated by randomly moving your mouse and tapping on the keyboard.

[Edit]
Mario has a great link to an article on CP: Getting the user idle time with C#[^]
[/Edit]

Regards,

Manfred
 
Share this answer
 
v2
Comments
Member 12824420 27-Feb-21 19:18pm    
I have been spending some time looking for an answer to the "original" question. How do you find out if the "system" is idle.

Lets say you want to shutdown the system when it is idle for some period of time.

I saw a question asking "dont you mean is the user idle?". I do mean is the system idle. If i create a service to check for Idle it is not logged in as a user so it immediately start counting down as idle. Regardless if a user is logged in or not.

I need something to run at startup that looks for the system to be idle regardless of who is logged in or if the system is sitting at a login prompt.

Everything seems dependent on what "a" user is doing or "a" program window. If more than one user is logged into a system and the counter is started with the user in the background then the system can be shutdown with an active user or your windows is pushed to the background and is idle. So i am really looking for a way to see if the system is idle and then I can create a service to shut down the system when it is idle.

Microsoft looks at something to determine if the system is idle and will put it to sleep. I just cant find out what they are looking at.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900