I trying to write a general error recovery procedure. When my VFP program encounters a situation it cannot resolve, such as inability to open a data file, I want to display a message, clean up, and return to the main screen and menu. This could occur almost anywhere in the program and at any read level.
I have tried the following code:
procedure AbortProc
*- display message
...
*- close all tables
close all
*- release popups
release popups
*- release all user windows
clear windows
*- release memvars except globals and a few we need
release all except p_*, cTitle, mainbutton
set procedure to
*- return to main menu
return to master && AbortProc
This seems to work most of the time, but in some situations what happens is that after returning to the main menu, when I select a menu item the program crashs. ("VFP has encountered a program and needs to shut down...") I guess I'm not cleaning up correctly, but I don't see what else to do.
Does anyone have suggestions?
Thomas M. Lamm
Bradbury & Associates