How to access VFP popup errors?

Hi all

I am writing an external application which can detect Foxpro errors. The problem I am having is the native VFP error popup. I can not access the message text in that popup. Windows API can only return the handle and the title of the main popup window. It does not detect any children of that window.

Sample: Is there a way that I can access to the "Variable 'A' is not found." text message from an external app This screen shot is a sample:
http://img.photobucket.com/albums/v306/xedap/fox2.jpg

Windows API can detect and access other appplication popups. With the MESSAGEBOX in VFP, I can access the text message without any problem. It has its own title and window handle. Here is the screen shot of it:
http://img.photobucket.com/albums/v306/xedap/fox1.jpg

The OS is Windows 2000 and Windows Server 2003. VFP version is 9.0
Thank you.

Xedap



Answer this question

How to access VFP popup errors?

  • DialogDude

    Thanks David for your reply.

    The problem is I support over 500 big and small VFP programs running on 30 machines, written by more than 40 different developers and non-IT persons (cut-n-paste methods a.k.a. messy) in VFP 6.0 then convert to 9.0. Most of them do not have ON ERROR event handlers (over 90%) The ones with ON ERROR handle only common errors. Even with proper ON ERROR methods, it does not guarantee all errors will be capture and handle by the event handlers (errors like: fatal exception errors, "Window has dectect an error and this application has to shut down", mail server is down so alert messages generated by event handlers can not be sent, lost connection to network drives, ...)

    That's why I am writing an external application to detect and report any VFP popups. My program (written in Borland Delphi 6) can report most of the errors except the native VFP popup ones. Tongue Tied

    Thanks
    Xedap

  • KamranAmin

    Thank you, David.

    I'll try your suggestion.

    Xedap.

  • Yves1

    Why don't you use an ON ERROR and Error() methods and potentially TRY/CATCH blocks to trap and deal with the errors inside the VFP code Check out these Wiki articles http://fox.wikis.com/wc.dll Wiki~CategoryErrorHandling. Specifically read Doug Hennig's paper.

  • Frik

    I think you may have a problem with the pop-ups because they are not true "windows" (i.e. do not have an individual HWnd) and I don't know of any way to detect their presence, or absence, externally.

    If you do find a method, do let us know. Good luck.

  • Rattlerfxr

    Xedap,

    For those that don't have proper error handling built in you can wrap them up with an error handler of a new calling program. ie create a launcher class that has an overridden Error() method. Then call into the existing code from another method of the launcher class and now you've provided an error handler on the execution stack that VFP can use besides it's own default handling.

    As far as the Fatal Exception errors, Windows itself pops those up.

    Make sure that all of the machines running this code under VFP6 have SP5 installed. You can run into lots of errors like this if the code was compiled under one SP and run under another. SP5 fixes lots of fatal errors. You can use a call to version(4) to determine which build number the code is running under. SP5 is build 8961.



  • How to access VFP popup errors?