Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can't get VFP to auto-shutdown each night
Message
 
 
To
17/12/2002 17:15:00
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00733898
Message ID:
00733926
Views:
49
This message has been marked as the solution to the initial question of the thread.
Albert,

You can't really call Destroy(). It is an event that happens when an object is destructing. Calling the Destroy() method does not cause the object to be destroyed, all it does is run whatever code you happen to have put into the method.

I think you'd be better off in your Timer doing something like:
IF VAL(LEFT(TIME(),2)) >= 23

   * destroy the object and then try to quit
   thisform.Release()
ENDIF
Where the form.Destroy() issues a CLEAR EVENTS which will let your server continue on past the READ EVENTS you executed to keep the exe running in the first place.

This also kind of assumes that the program will never run between the hours of 11pm to midnight.

>We have a VFP app running as a service on one of our servers. It opens up data files and chugs along all day. But at night, I want to have it shut itself down at 11 pm so we get a better backup of data.
>
>It is a visual process as it displays a form that shows errors, number of jobs processed etc. So on this form I have a timer object that both checks for new jobs (every 5 seconds) and then also checks the current time and if after 11 pm, it tries to shut the app down. Here is the code I use (in the timer event of the timer):
>
>IF VAL(LEFT(TIME(),2)) >= 23
>
> * destroy the object and then try to quit
> ON ERROR
> THISFORM.Destroy
>
> ON SHUTDOWN
> QUIT
>
>ENDIF
>
>******** END OF CODE ***
>
>Result: it closes the form and therefore *most* dbf files are closed (the form is a private data session so they open files close when the form closes) but the app as a whole does not close ie. I am left with the main screen up and the menus. Also, checking backup log files, I have a few files left open that are opened when the app starts up ie. in the default datasession.
>
>I did something similar to this in the old days (FPD2.6) and it worked ie. Quit worked pretty well from anywhere!
>
>Is there anything else I need to kill before issuing Quit? Do I need to somehow kill the form from outside the form (on the screen?) so that there is no form open when Quit is issued?
>
>Albert
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform