I am working with a customer app written with VFP8. We had a 'bug'
preventing us to do the night backup : someone has left his app opened in
a report preview before leaving. So the tables were opened ...
Have we a way to abort the report preview window after a timer (one hour
for example) ?
I have an unattended shutdown feature in my application. It works like this:
My application manager object has a logical property called IsActive,
defaults to .F.
Most of my control base classes (commandbutton, checkbox, combobox,
textbox, etc.) have code in their Click() or GotFocus() methods that set
oApp.IsActive to .T.
I have a timer whose Timer() method polls oApp.IsActive. The interval
defaults to 15 minutes (it's user-configurable though).
If Timer() finds oApp.IsActive is .T., it sets it to .F. and exits.
However, if it finds oApp.IsActive is .F., it sets another application
manager property, KillSwitch, to .T. Then it launches a "countdown" form
with another timer on it, and a big "ABORT" button.
Pressing ABORT sets the application manager's KillSwitch property to .F.
The second Timer's interval defaults to 1 second. This Timer's Timer()
method maintains a countdown, starting at a user-defined number (defaults
to 10). If the countdown has not reached 0, it polls oApp.KillSwitch and if
that property is .T., it decrements the countdown value by 1 and displays
remaining seconds on the form. If KillSwitch is still .T. when the
countdown reaches 0, the Timer() method starts an irreversible process that
shuts down the application. If KillSwitch is .F., the countdown timer
closes the countdown form and shuts itself off. The "ABORT" button, being
based on my command button baseclass, has already set oApp.IsActive to .T.
when it was clicked. So the first timer reverts to its usual behavior and
the application continues to run.
(I have a second, similar class called "EverybodyOutOfThePool", only this
one watches for a semaphore file on the server, and if it finds one, it
starts a shutdown that cannot be aborted. This one is used to force all
users to log out at any time, regardless of what they are doing.)
It's a bit more complex than that, but that's basically how it works.
Both of these work quite well. The only caveat is that for debugging
purposes in development mode, the timers have to be turned off so they
don't shut down the application while I'm poking around in the debugger.
This is done as soon as the developer responds "Yes" to a "Debug?" messagebox.
Ken Dibble
www.stic-cil.org
_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message:
http://leafe.com/archives/byMID/profox/5.2.1.1.1.20140911192640.01db5...@pop-server.stny.rr.com
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.