Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to detect my application is idle in c#? [duplicate]

Tags:

c#

Possible Duplicate:
Check if an application is idle for a time period and lock it

Suppose I have a Windows product developed with C#. Now a requirement comes that if that application running and idle and when user try to interact with that application again then a login screen come. How to detect that my applications is idle when it is running? Please guide me to complete the job.

like image 333
Mou Avatar asked Jan 20 '23 20:01

Mou


1 Answers

  1. Add a timer control to your application.
  2. Subscribe to mouseover and keydown events - when they fire, reset the timer.
  3. When the timer fires (ie mouse hasn't moved and key's haven't been pressed for x amount of time), lock the screen / prompt for login.
like image 115
Nathan Avatar answered Jan 31 '23 02:01

Nathan