Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TROUBLE CLOSING PROGRAM

Status
Not open for further replies.

bebbo

Programmer
Dec 5, 2000
621
GB
I Have started a program by the following
do form .......
READ EVENTS
release all
close all
When trying to stop this program I use the following

CLEAR EVENTS
THISFORM.RELEASE

This does stop it however VFP is still running. I have to press Cntrl, Alt Del and end process. Should I run this in debug mode the debug stops when it gets back to READ EVENTS. Any Ideas??
 
Put the CLEAR EVENTS in the forms destroy property. That way, any way you exit the program this command will be issued.
 
i believe it may be as simple as issuing the QUIT command. you may want to try the following after THISFORM.RELEASE in your calling program.

clear dlls
release all extended
clear all
quit
 
tHATS FIND BUT i GET THE SAME RESULT. More info, the foxpro screen appears but the majority of the options ie file new or open are greyed out. You have to goto program then pick cancel. This brings the Command Window back and everthing appears OK.
 
What usually works for me is...

In the mystartup.prg file:

DO FORM "myform.scx"
READ EVENTS

CLOSE DATABASES ALL
CLOSE TABLES ALL


In the Form's Unload Event put:

CLEAR EVENTS


This usually solves it for me, though i have noticed when i use the PageFrame control then i sometimes have trouble getting the program to quit. Another thing to look at is wether or not your databases and tables are being closed properly. If their in the DataEnvironment, then they will close automatically by the form, but if your opening and using them in code, then you must close any databases and tables you've opened.

Stephen
 
Hi I've tried al of the commands below after READ EVENTS. Everything appears to close but my EXE still remains in the processes of Windows NT Task Mnager. Any other ideas?

release all
close all
clear all
clear dlls
release all extended
quit
CLOSE DATABASES ALL
CLOSE TABLES ALL
 
Don't ask me why but if I put a wait window or messagebox after read events everthing shuts down OK!!
 
bebbo

release all
close all
clear all
clear dlls
release all extended
quit
CLOSE DATABASES ALL
CLOSE TABLES ALL

Try :-

release all
close all
clear all
clear dlls
release all extended
CLOSE DATABASES ALL
CLOSE TABLES ALL
quit

Chris :)




 
bebbo

Omitted from previous post

When trying to stop this program I use the following

CLEAR EVENTS
THISFORM.RELEASE

should be:-

THISFORM.RELEASE
CLEAR EVENTS

Chris :)
 
You might try adding an ON SHUTDOWN routine. e.g.
In the Main.Prg

ON SHUTDOWN DO myShutdown

PROCEDURE myShutdown
&& Test for user's intent
ON SHUTDOWN
CLEAR EVENTS
QUIT

In this case all requests to shutdown the application are going to hit this procedure so you could add additional testing to make sure a shutdown is really the intent. Issuing QUIT should close all tables and release all variables etc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top