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

Fox icon in error windows

Status
Not open for further replies.

Rich196

Programmer
May 17, 2003
42
US
I have a VFP8 app and am forcing an error to check error handling. I have code in the errhand to collect error info and send an email. All windows in the app and the main VFP window have the app icon, however, when the error occurs I get a window with a title bar that says "Program Error" and it has the fox icon. When I "cancel" I get another window with a title bar that has the title, as specified in the config file, and the fox icon. It shows the command window.

The config file has _screen.icon = and _screen.visible =.
The app icon is set in project info.

How can I get rid of the fox icon in these cases and replace it with the app's icon? Is there a way to not show the second window?

Thanks in advance,
Rich
 
Rich,

The icon that you get in the standard VFP error message (as generated by the built-in error handler) is the same as the _SCREEN.Icon.

However, if you set _SCREEN.Icon to a blank string (which I think is what you are doing), then the Fox icon will appear instead. So just set _SCREEN.Icon to the name of a valid ICO file, and you should get the desired result.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Code:
*!* Put the following at the very top of your main.prg
On Error Do MyErrHandler WITH ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO(1)


the problem is that you aren't truly trapping the error if you are seeing the default VFP error dialog box, if you were you wouldn't see this dialog. So use that On Error line and substitute your error handling routine name for the "MyErrHandler" and send in whatever error information you want to your error handler I provide the parameters above just as an example.

As for changing VFP's default icon for this, I'm not sure how you would do this...it is probably compiled into the runtimes...I guess you could maybe hack something with a resource hacker and put your own icon in there...but I'd be a little leary of doing something like that.

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Are you sure Mike?

I just went into VFP and changed the screen icon and ran the following from the command window and still saw the Fox...

x = y &&Cause an error

boyd.gif

craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Craig,

My mistake. I must have been confusing this with something else.

But I think your main point is the important one. If Rich is seeing the built-in error dialogue, he is not really trapping the error.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
At the beginning of my errhand"

PROCEDURE errhand
PARAMETER errnum, mess, mess1, prog, linenum
MESSAGEBOX('An error has occurred, please paste the error to the body of the email',64)
IF errnum = 114
(handle error here)
(produce report and send email)

In Main.prg:

ON ERROR DO errhand WITH ;
ERROR( ), MESSAGE( ), MESSAGE(1), PROGRAM( ), LINENO( )

Config has:

SCREEN = OFF
TITLE = Data Partners Solutions
_Screen.Icon = "c:\documents and settings\richard\my documents\dpregsys\dp.ico"
_Screen.visible = .f.

Pretty straight forward...

Rich
 
I just found it. I was turning off the handler and I had a recursion.

Thanks for your help. I should have caught it earlier. You made me think in the right direction.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top