cleanup Method
Class: application
Expand/Collapse source code of procedure cleanup Source Code
*-- When we wish to end the application, we cannot just
*-- simply release the application object (oApp) and expect
*-- the Destroy method to run without first issuing a 
*-- CLEAR EVENTS since the READ EVENTS was issued in the Do()
*-- method. Therefore, this method was created to 
*-- clean up the environment before quitting the application.
*-- It also allows us to conditionally stop the user from 
*-- exiting the program for whatever reason. 

LOCAL lnForm, lnFormToClose
LOCAL loForm

THIS.lQuitting = .T.
FOR EACH loForm IN application.Forms
	IF TYPE("loForm") == "O" AND loForm.Baseclass == "Form"
		IF !loForm.QueryUnload()
			RETURN .F.
		ENDIF
		loForm.Release()
	ENDIF
ENDFOR
RETURN .T.