Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Intercepting errors from an API/Dll
Message
 
To
04/01/2000 11:10:14
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00312450
Message ID:
00312456
Views:
24
>Hi All,
>
>I'm using VFP 6.0 and accessing data through a .dll. I've created a test program in which I've included delibrate errors to see if how the .dll responds. I want to intercept these error and continue. Since they are not VFP errors ON ERROR and ON ERROR Resume Next doesn't appear to work. How can I intercept these errors and continue on to the next test? TIA.
>
>Regards,
>
Hi Paige,

Typically, the return value of a DLL indicates the success or failure. These generally, in Win32, fall into two types. Either the function returns ERROR_SUCCESS (0) or it'll return 0 if the function fails. In this latter case, this value equates to Boolean FALSE, and the function is defined as returning a "BOOL". In this case, usually you would call GetLastError() to retrieve the error code. This is a generalization, however, since quite a number of functions don't follow this convention.

Now if you're creating a VFP DLL, you could expose an error number property, that you could check immediately after the call. What you'd do is set this value on entry, and if the some sort of error occurred jump through a method to set your error code.
George

Ubi caritas et amor, deus ibi est
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform