RELEASE ALL EXTENDEDinstead. If you are using VFP 8 or 9, you could use TRY/CATCH instead:
TRY loSysTray = CREATEOBJECT("mySysTray") IF TYPE("loSysTray") == "O" READ EVENTS ENDIF CATCH TO loEx CreateErrorLog (loEx.Procedure, loEx.LineNo, loEx.Message, loEx.ErrorNo, loEx.Line, SYS (16)) ENDTRY RELEASE ALL EXTENDED CLEAR ALL CLEAR MEMORY CLEAR PROGRAM && CLEAR PROGRAMS FROM MEMORY CLOSE ALL CLEARHTH
>... >ON ERROR DO ErrHandler WITH PROGRAM(),LINENO(),MESSAGE(),ERROR(),MESSAGE(1), SYS(16) >... >loSysTray = CREATEOBJECT("mySysTray") >IF TYPE("loSysTray") == "O" > READ EVENTS >ENDIF > >RELEASE loSysTray >...>My ErrHandler routine tries to exit "gracefully" by logging an error message and exiting the program.
>PROCEDURE ErrHandler >LPARAMETERS cProgram, nLineNo, cMessage, nErrorNo, cLine, cProgFile > > = CreateErrorLog(cProgram,nLineNo,cMessage,nErrorNo,cLine,cProgFile) > > ON ERROR > RELEASE ALL > CLEAR ALL > CLEAR MEMORY > CLEAR PROGRAM && CLEAR PROGRAMS FROM MEMORY > CLOSE ALL > CLEAR > > QUIT >ENDPROC>However, I find that when I have an error occur within my System Tray class, my Errorhandler hangs up when it gets to the CLEAR ALL command. I receive a message that says that the systray.vcx (from which mySysTray was subclassed) is in use and can not be cleared. I'm guessing that somehow loSysTray is not being released but I thought the RELEASE ALL would take care of that.