handling fatal errors at run time

Microsoft Visual FoxPro - Programmer Exchange

So far, I have not gotten reports of FoxPro errors occurring in applications 
I've distributed. I've gotten plenty in development to be sure, but I 
haven't heard about those from users. Yet.

When that happens, is there anything I can do to control the box that pops 
up saying things like "fatal error" and "FoxPro" and "Send report to 
Microsoft"? I haven't decided exactly what kind of control I want over it, 
but I'd like to know whether it's even possible.
Hi Paul,

there's a chapter on error handling in the help
that's more verbose than what I can write here.

But in short, you can write an
handler that would handle all errors, you can
handle error locally by 
and you can use ERROR() events in most

If the error occurs, values of
LINENO(1) and POGRAM() are helpful,
but you can get most of these infos also

with AERROR() and with ASTACKINFO().

You could put all these infos in a cursor,
cursortoxml the data and send that to you
via mail or at least store it in an error table.

Then you can cancel, return or retry with

Take a look here:

Bye, Olaf.
I guess I didn't make myself clear. I'm talking about C0000008-style errors.
Hi Paul,

I have some C0000005 sometimes. Mostly during
development. You have no chance handling these
with a vfp error handler, these are happening in the
vfp runtime module, so really vfp crashes.

The CX message itself can also be found in a vfpXerr.log
So an easy way to get at this info is storing that log
file in some error table or sending this via mail.

Mostly it's still no vfp bug, but your code wasn't handling
object destruction correctly, so you have a half dead object
and some object reference pointing to a dead object, which
may cause acccess to memory having been freed and not
belonging to our process anymore. See what Bill has linked
to Calvian Hsias blog, he's using Sys(1079) to intentio-
nally crash the system.

If it's not dangling object references, mostly it's graphic
driver issues, printer driver issues, corrupt frx, dbf, dbc,
anything that makes the vfp9r.dll access restricted area
and thereby causing an error exception.

With C5 or C8 or errors of that range, you need to
handle that on the C++ level, remember vfp is programmed
in C++, Calvin talks about dynamically attaching a debugger
and has some additional articles.

Bye, Olaf.
Just got another one:

Microsoft Visual FoxPro has encountered a problem and needs to close.
We are sorry for the inconvenience.