Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I handle error in non-visual class?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00949854
Message ID:
00949946
Views:
15
Try
RELEASE ALL EXTENDED
instead. 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
CLEAR
HTH

>In my shell program I have the following:
>...
>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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform