I want to know if the mouse did not move for two minutes, If so a log out will occur automatically. Plz help.
Asked
Active
Viewed 2,099 times
-9
-
1This is not a good way to ask a question here. Did you try _anything_ so far to solve your problem? Show your effort first so people might show theirs. Please read [FAQ], [ask] and [help] – Soner Gönül Dec 22 '14 at 09:06
-
Please check these questions this will help you. http://stackoverflow.com/questions/20983375/how-to-expire-a-session-if-user-leave-an-interface-for-2-minutes-asp-net OR http://stackoverflow.com/questions/4603374/how-can-i-trigger-an-auto-logout-within-a-windows-forms-application – sagar43 Dec 22 '14 at 09:08
-
Use a timer that gets reset every time the mouse move event is triggered. Or look in to handling window messages – musefan Dec 22 '14 at 09:08
1 Answers
6
- Add a timer control to your application.
- Subscribe to mouseover and keydown events - when they fire, reset the timer.
- 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.
This could also help: http://www.codeproject.com/Articles/13756/Detecting-Application-Idleness

kinezu
- 1,212
- 2
- 12
- 23