Hi,
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"
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.
While the description is more.. actual code is very less.
I will be adding this as an FAQ soon
ramani 
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
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"
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.
While the description is more.. actual code is very less.
I will be adding this as an FAQ soon
(Subramanian.G),FoxAcc, ramani_g@yahoo.com