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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to hide Foxpro error dialog box

Status
Not open for further replies.

Rich196

Programmer
May 17, 2003
42
US
Is there a way to hide a Foxpro dialog box or keep it from being displayed? I'm testing my err handler and if a program error occurs there is a program error dialog that pops up. Since I am collecting the error information I don't want the user to see the message.

Rich
 
Just a small example of what you want, obviously you would want to send in more information like lineno and program etc...

ON ERROR DO MyErrHandler With Error()
x=x + y && Throw an error

Procedure MyErrHandler(tnErrorNumber)
*!* Check the error number and do something with it
messagebox(tnErrorNumber)
endproc

boyd.gif

 
Thanks for the reply Craig.

My apologies I should have been clearer. I already have the error handler working and collecting the proper information. In the process, when the error occurs, Foxpro, (not my code), shows a dialog box with the fox icon and the words "Program Error" in the title bar. My question is, is there a way to stop that dialog box from being shown?

Rich
 
I am using the ERROR command to generate an error and any number I use gives me the "Program Error" dialog box.

The code I am using is:

In Main.prg...
ON ERROR DO errhand WITH ;
ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )

In stored procedures...
PROCEDURE errhand
PARAMETER errnum,mess,mess1,prog,linenum

DELETE FILE "c:\errrep.txt"
SELECT errrep
APPEND blank
replace errno WITH ALLTRIM(STR(errnum))
replace message WITH ALLTRIM(mess)
replace message1 WITH ALLTRIM(mess1)
replace program WITH ALLTRIM(prog)
replace lineno WITH str(linenum)
DO dorep.prg

_cliptext = filetostr("c:\errrep.txt")

Rich

 
You shouldn't be getting the error dialog...is it possible that somewhere in the code the statement "ON ERROR" is issued and error handling reset to default? Odd though, because then your errhand procedure shouldn't be getting called at all.

Hmmmm...what happens if you run the following from in the VFP IDE? Does it give you the messagebox or does it give you the default error dialogbox?

Code:
ON ERROR DO errhand WITH ;
   ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )
x = y + x

ON ERROR

PROCEDURE errhand
PARAMETER errnum,mess,mess1,prog,linenum
	MESSAGEBOX(mess,64,"CUSTOM ERROR HANDLER")
ENDPROC

boyd.gif

 
It just gives me the "Custom Error Handler" dialog box.
H-m-m-m. somehow I must be resetting the error handler and again I'm getting a recursive error? I'll check the code again!

Rich
 
Oh my! I was working with a restored copy of an old errhand proc.

Thanks for the help
Rich
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top