Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Detect Idle time
Message
 
To
04/10/2004 07:04:36
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00948405
Message ID:
00948440
Views:
17
>Dear Sir,
>
>Is it possible to detect application idle time.
>
>Reason
>
>I want to add some codes in my main prg,
>if idle time is greater than 5 minutes then my exe must automatically quit.
>
>Please help

There is no default Visual FoxPro functionality to do this, however that could be done.

Basically you need to log the user activiy on the application. You need to add the code to the your subclasses that record the last action that was done with the control and a timestamp. That can be stored in a table, some object property, etc. Then you should have a timer that will check this information in a certain intervals, compare and decide if there was an inactivity.

If inactivity is detected, you can pop-up the modal login form, or shut down the application.

However, in the last case you need to make an educated guess what to do with the changes, if the user left the form in Edit mode. That can involve a lot of different situations with the updated data. I have one application that works like this and shuts down at a certain time.

One way to detect the complete inactivity is to check MROW(), MCOL() and the LASTKEY(). That combination could be saved and checked upon.
However there is an assumption that the user just left the app on screen and doing nothing else. If the user switches to another application, there will be some processes going on, i.e. form deactivates, possibly running some code, mouse moves, etc.

Also, there is UdleUI.dll that can be found on MSDN site, that also has functions to detect the input timeout.
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Previous
Reply
Map
View

Click here to load this message in the networking platform