My FoxPro program has a quit button and the usual min/max/X buttons in the top right, and when using either the program disappears and seems to have closed properly. However, when I check my Task Manager, I find that it is still running.
This is my main.prg file:
ON SHUTDOWN CLEAR EVENTS
with _screen
.visible = .f.
endwith
DO FORM locations\form1
READ EVENTS
ON SHUTDOWN
and this is the code for my exit button ‘click’ event:
unlock all
close database all
clear events
RELEASE ALL
quit
My program has only the one form and it’s set as top-level… any suggestions as to how I can fix this?
Thanks for your time and help 🙂
If you are running VFP originating from the IDE (Development environment), and you do _Screen.Visible = .F., you are HIDING the main VFP screen, and the system may be returning directly to that, and since you can’t see it, you cant formally quit.
In your MAIN.PRG, put the following down at the bottom as a separate “function” that will be visible within the call stack.
Then, in your start, change your ON SHUTDOWN to call this “function”… Right now, you are only issuing a single command of clear events. This way, you can wrap up a bunch of “cleanup” operations before closing, and not just clearing the read events.