Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all
How to capture the idle time and show log out msg? e.g. If the system is idle for 20mins., then it needs to show log out msg and exit from windows application. If user activity occurs prior to 20mins., then reset timer again.






Regards
Aravind
Posted
Updated 20-Jan-14 9:16am
v2

How to use a Timer:

http://msdn.microsoft.com/en-us/library/system.windows.forms.timer(v=vs.100).aspx

* Use the Start method to start the time ticking.
* Use Stop then Start to restart the timer.
* Handle the Tick event to know when your time is expired.

How to exit an application:

http://msdn.microsoft.com/en-us/library/ms157894(v=vs.100).aspx
 
Share this answer
 
This may be what you are looking for. I have a modified version for a viewer that locks a document while the user has it open and if the viewer detects no activity it releases the lock and closes the document. It has worked very well.
Detecting Application Idleness[^]
 
Share this answer
 
Comments
Aravindba 20-Jan-14 21:54pm    
Thanks for ur reply,how it work,if ideal for 10s it not close application,i need fo opening of form need to check for 2 mins,if nobody use form ,show msg if click ok close application,if click no ,continue to work,no need to show any gui,cpu active stauts.

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