VBFOXDEV35
Programmer
All:
Real quick question. I have an error handler built into my code, however sometimes when this handler fires, it causes any output to be directed to the current open form/screen
Can anyone tell me what might cause this? It's almost as if a VFP error set's the console back on, very strange.
Here is my error handler just in case it might be incorrect:
PROCEDURE HandleError
PARAMETER plngLineNo
LOCAL strTitle
LOCAL strBody
LOCAL strProgram
CLOSE DATABASES
SET CONSOLE OFF
SET ALTERNATE OFF
SET BELL ON
IF ERROR() = 2028 THEN
RETRY
ENDIF
IF VarType(plngLineNo) = "L" THEN
plngLineNo = 0
ENDIF
strProgram = SYS(16,PROGRAM(-1)-2)
IF AT(" ",strProgram) > 0 THEN
strProgram = SUBSTR(strProgram,RAT(" ",strProgram) + 1)
ENDIF
IF AT("\",strProgram) > 0 THEN
strProgram = SUBSTR(strProgram,RAT("\",strProgram) + 1)
ENDIF
strProgram = LEFT(strProgram,MAX(LEN(strProgram)-4,0))
IF strProgram <> PROGRAM(PROGRAM(-1)-2) THEN
strProgram = strProgram + "." + PROGRAM(PROGRAM(-1)-2)
ENDIF
strTitle = "Notice #" + LTRIM(STR(ERROR()))
strBody = MESSAGE() + CHR(13) + CHR(10) + CHR(13) + CHR(10)
strBody = strBody + "Line #" + LTRIM(STR(plngLineNo)) + " of " + strProgram
IF !EMPTY(MESSAGE(1)) THEN
strBody = strBody + ":" + CHR(13) + CHR(10) + " " + MESSAGE(1)
ENDIF
IF !EMPTY(GetSysData("CLASDIR") THEN
strBody = strBody + CHR(13) + CHR(10) + CHR(13) + CHR(10)
strBody = strBody + "Cancel will reset the program to when the deal was first selected."
ENDIF
IF MessageBox(strBody,5 + 64,strTitle) = 4 THEN
RETRY
ENDIF
WAIT CLEAR
ON ERROR
CLOSE DATABASES
CLEAR EVENTS
RELEASE ALL
CLOSE ALL
IF VARTYPE(gfrmSplash) = "O" THEN
gfrmSplash.Release
ENDIF
CHDIR &gstrFishDir.
** set flag that there was an error to reload winfish
blnHaveError = .T.
SET BELL OFF
RETURN TO MASTER
Thanks all for those who reply.
Art
Art DeGaetano II
Software Developer, MOUS
Real quick question. I have an error handler built into my code, however sometimes when this handler fires, it causes any output to be directed to the current open form/screen
Can anyone tell me what might cause this? It's almost as if a VFP error set's the console back on, very strange.
Here is my error handler just in case it might be incorrect:
PROCEDURE HandleError
PARAMETER plngLineNo
LOCAL strTitle
LOCAL strBody
LOCAL strProgram
CLOSE DATABASES
SET CONSOLE OFF
SET ALTERNATE OFF
SET BELL ON
IF ERROR() = 2028 THEN
RETRY
ENDIF
IF VarType(plngLineNo) = "L" THEN
plngLineNo = 0
ENDIF
strProgram = SYS(16,PROGRAM(-1)-2)
IF AT(" ",strProgram) > 0 THEN
strProgram = SUBSTR(strProgram,RAT(" ",strProgram) + 1)
ENDIF
IF AT("\",strProgram) > 0 THEN
strProgram = SUBSTR(strProgram,RAT("\",strProgram) + 1)
ENDIF
strProgram = LEFT(strProgram,MAX(LEN(strProgram)-4,0))
IF strProgram <> PROGRAM(PROGRAM(-1)-2) THEN
strProgram = strProgram + "." + PROGRAM(PROGRAM(-1)-2)
ENDIF
strTitle = "Notice #" + LTRIM(STR(ERROR()))
strBody = MESSAGE() + CHR(13) + CHR(10) + CHR(13) + CHR(10)
strBody = strBody + "Line #" + LTRIM(STR(plngLineNo)) + " of " + strProgram
IF !EMPTY(MESSAGE(1)) THEN
strBody = strBody + ":" + CHR(13) + CHR(10) + " " + MESSAGE(1)
ENDIF
IF !EMPTY(GetSysData("CLASDIR") THEN
strBody = strBody + CHR(13) + CHR(10) + CHR(13) + CHR(10)
strBody = strBody + "Cancel will reset the program to when the deal was first selected."
ENDIF
IF MessageBox(strBody,5 + 64,strTitle) = 4 THEN
RETRY
ENDIF
WAIT CLEAR
ON ERROR
CLOSE DATABASES
CLEAR EVENTS
RELEASE ALL
CLOSE ALL
IF VARTYPE(gfrmSplash) = "O" THEN
gfrmSplash.Release
ENDIF
CHDIR &gstrFishDir.
** set flag that there was an error to reload winfish
blnHaveError = .T.
SET BELL OFF
RETURN TO MASTER
Thanks all for those who reply.
Art
Art DeGaetano II
Software Developer, MOUS