*********************************************************
** Author : Ramani (Subramanian.G)
** FoxAcc Software / Winners Software
** ramani_g@yahoo.com
** Type : Copyrights reserved except for personal use
** Warranty : Nothing implied or explicit
** Last modified : 10 February, 2003
*********************************************************
1. In your Main.PRG ..
Before the main event is started..
Add code...
***************************************************
PUBLIC pnShutSeconds, ptShutTime
pnShutSeconds = 0
ptShutTime = {}
***************************************************
** To avoid new users from starting application **
IF FILE("DoShut.txt")
=MESSAGEBOX("Try after some time",0+16+ ;
"System maintenance in progress")
QUIT
ENDIF
***************************************************
2. Add a timer class to your application.
In the Timer event of the Timer class.. add the code..
******************************************************
IF m.pnShutSeconds = 0
IF FILE("DoShut.txt")
m.pnShutSeconds = VAL(FILETOSTR("DoShut.txt"))
m.ptShutTime = DATETIME()+VAL(FILETOSTR("DoShut.txt"))
ENDIF
ENDIF
IF m.pnShutSeconds > 0
WAIT WINDOW "Maintenance shutdown called by " + ;
"System Administrator" + CHR(13)+ ;
"Please Close down your application before " + ;
"the forced shutdown."+ CHR(13)+ CHR(13)+;
"ShutDown Time "+TTOC(m.ptShutTime) + CHR(13)+ ;
"Current Time is "+TTOC(DATETIME()) NOWAIT NOCLEAR
IF DATETIME() > m.ptShutTime
** Instead of ThisForm.Release,
** you may have to call a shutdown routine.
WAIT CLEAR
ThisForm.Release()
ENDIF
ENDIF
******************************************************
3. Set the timer interval as 1000 (1 second) or even (10000=10 seconds) so that the resources are not drained by the timer call.
4. Drop this timer class in your base application form
or drop it in all forms of your application.
5. Steps you have to take.. to make this call..
a. When you need to make a shutdown call..
b. Start VFP.. change to the default application
directory in the server place..
c. Decide the shutdown time you want to allow
This shall be in seconds.. say 300 for 5 minutes
d. In the command window..
STRTOFILE("300","DoShut.txt")
[Note: Avoid opening a text file with the name
DoShut.txt using command as MODI FILE DoShut.txt
since that will open a file with a lock and
create an error in the Timer event of application.
So either copy a file or do as above to make an
instatneous DoShut.txt]
e. In 5 + probable lag due timer firing interval
i.e. say 5 minutes 10 seconds
All will be forced shutdown by the timer call.
f. DO YOUR MAINTENANCE
g. DELETE file DoShut.txt
or else no one will be able to get on.
*********************************************************
* EOF:
*********************************************************
Evaluate this to make others know how useful is this
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.