You can create customized quit routines for your application when the user wants to quit your application, Visual FoxPro, or Microsoft Windows.
To create a quit routine
Use the ON SHUTDOWN command and include a command or procedure to run.
The ON SHUTDOWN command typically uses a DO command to call a procedure or program if a user tries to quit the application. For example, the following line of code specifies a quit routine named My_QuitRoutine:
ON SHUTDOWN DO My_QuitRoutine
The quit routine typically includes a dialog box that prompts the user whether they want to quit the current application. If the user wants to quit the application, the routine can close open files and clean up the environment, and then call the QUIT command. If the user does not want to exit the current application, the routine can return control to the application.
For more information, see ON SHUTDOWN Command.