Does anyone know of a way to detect recent activity in a VB.net windows forms application?
We have a retail store where users share floor computers, the application will be on each machine and require a log in before use. I am trying to find a way to automatically close the application if it has been idle for lets say 10 minutes.
I guess I could do something similar with the current windows log on session – set a gp that logs the user out after 10 minutes of inactivity – but if there is an easy, non memory intensive way to do it in vb.net i would rather use that method
thanks
When the applications starts, create a handler for the
Application.Idleevent. Also create an object that is your 10-minute timer. TheAppliation.Idleevent is raised every time the event queue is empty. If you move the mouse, that raises an event. If you press a key, that raises an event. Note that you cannot use theHandleskeyword withApplication.Idle.Handlesonly works for locally decalred objects, not static objects.The only issue with this is if the user starts an action that takes longer than 10 minutes, it will raise
Application.IdleafterTenMinuteTimer.Expire. If you expect this may happen, be sure to disable the TenMinuteTimer before executing long-running code and enable it again afterwards.