Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Inactivity Timeout
Message
General information
Forum:
Visual FoxPro
Category:
Other
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01156931
Message ID:
01157265
Views:
40
>Has anyone coded an inactivity timeout in their VFP app?

Yes, and we force the end users to login to the app again, too.

>I have a couple of ideas, but they have holes in them. I'm thinking
>of setting a variable to datetime() and using a timer (about once a minute)
>to check if the allowable time has passed. The problem, of course, is how to
>reset the variable that holds datetime() whenever user activity happens.
>
>I can use the forms' mousemove and keypress (with keypreview) events to update
>the variable. But it would probably also mean having to code into the mousemove
>and keypress events of every base control.
>Anybody done this a more sensible way maybe using the windows API?

Create a timer on the main form. Let's call it Timer1, because that's
what VFP is going to give you anyway (by default). In the MouseDown,
MouseMove, and KeyPress events on the main form, make a call to
thisform.Timer1.reset()
Put this code (or whatever fits your needs) into Timer1's "Timer" Event:
IF _screen.activeform.name != "relogin"
	DO FORM relogin
ENDIF
This code makes sure that the relogin form isn't already being displayed, of
course.

Best Regards, and hope this helps.

Randall
--
Randall Jouett
Amateur/Ham Radio: AB5NI
I eat spaghetti code out of a bit bucket while sitting at a hash table! Someone
asked me if I needed salt, and I said, "I'm not into encryption." :^)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform