Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Application timer / timeout ??
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01484249
Message ID:
01484261
Views:
57
>I need to add a 'timeout' feature to a VFP application.
>Basically all I need it to do is after 30 minutes of inactivity I need the application to close. Seems easy enough to create a timer object - but is there an easy way to tell if there has been any activity (mouse or keyboard) in the app?

In general you can do something like this:

- If you have a goApp application object, attach two properties to it: "TimeOut" and "TimeRemaining"
- Set the TimeOut value to be 30 (minutes)
- Initially set the TimeRemaining value to be equal to the TimeOut

- Set your timer to fire every 60,000 msec (60 seconds)
- When it fires, get it to decrement goApp.TimeRemaining
- If goApp.TimeRemaining = 0, shut down

As you point out, the tricky part is determining if mouse/keyboard activity happens. Whatever method you use, you just set goApp.TimeRemaining = goApp.TimeOut

You could perhaps:
- implement global mouse and KeyPress handlers
- it might be possible to use BINDEVENTS() for something like this

Depending on the app, you might be able to get away with resetting goApp.TimeRemaining when forms/dialogs are opened (or other processing occurs), rather than trapping every keystroke or mouse action.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Reply
Map
View

Click here to load this message in the networking platform