Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

supress c5 error messagebox 2

Status
Not open for further replies.

AlastairP

Technical User
Feb 8, 2011
286
0
16
AU
I am looking for way to supress the C5 error messagebox.
I have a non visual utility program that runs briefly, does a small task and then shuts down.
Occasionally, maybe every 1000 or so executions I get a C5 error.
I will keep on looking to try and resolve the error, however I want to supress the error message box. In fact I want to supress any error message box.
Can this be done?

I am using a standard ON ERROR error handler that directs the error to file

MAIN.PRG
Code:
PARAMETERS payloadFile, testmode2

&&& MAIN.PRG &&&
ON ERROR DO ErrorHandler WITH ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO(1)

MAIN.PRG
Code:
********************
PROCEDURE ErrorHandler
********************
   PARAMETER tnError, tcMessage, tcMessage1, tcProgram, tnLineno
   LOCAL lcErrorMessage
   lcErrorMessage = "Date : " + TTOC(DATETIME(),3)  + CHR(13) + CHR(10) ;
   	  +	"Error number: " + TRANSFORM(tnError) + CHR(13) + CHR(10) ;
      + "Error message: " + tcMessage + CHR(13) + CHR(10) ;
      + "Line of code: " + tcMessage1 + CHR(13) + CHR(10);
      + "Program: " + tcProgram + CHR(13) + CHR(10);
      + "Line number: " + TRANSFORM(tnLineno)
   	
   	lcDirectory=_screen.clientpath
   	lcLine = CHR(13)  + CHR(10) + '*************************************************' 
   	lcFinalText = lcLine + CHR(13)+ CHR(10)  + lcErrorMessage + CHR(13)  + CHR(10)
   	
   	
   	
	IF DIRECTORY(_screen.clientpath) 
		SET SAFETY OFF  
		
		IF FILE(_screen.clientpath + 'ERRORLOG.TXT')
	 		lctext = FILETOSTR(_screen.clientpath + 'ERRORLOG.TXT')
	 		IF LEN(lctext > 10000000) 
	 			STRTOFILE(lcFinalText  , _screen.clientpath + 'ERRORLOG.TXT',0)
	 		ELSE 
	 			STRTOFILE(lcFinalText  , _screen.clientpath + 'ERRORLOG.TXT',1)
	 		ENDIF 	
	 	ELSE 
	 		STRTOFILE(lcFinalText  , _screen.clientpath + 'ERRORLOG.TXT',0)
	 	ENDIF 	

	    SET SAFETY ON       
	ENDIF 
		

   SET DEFAULT TO (_screen.clientpath)

   CLEAR EVENTS
   
ENDPROC


With regards
Alastair
 
Unfortunately, an ON ERROR handler cannot trap C5 errors. The C5 error happens before the error-handler can kick in.

As far as I know, the only way to prevent the C5 from appearing on the screen is to find the cause of the error and to eliminate it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thanks Mike,

The crash dump pointed to NahimicOSD.dll
It is an audio driver I believe.

Alastair

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top