Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Problem with Get/SetLastError
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00740147
Message ID:
00740149
Views:
15
Hi Jeff,

If you want to set an error code within a procedure and read it later -- the following code always works:

DECLARE INTEGER GetLastError IN kernel32
DECLARE SetLastError IN kernel32 LONG

= SetLastError(13) && ERROR_INVALID_DATA
? GetLastError()

* * *
If you are trying to retrieve an error code after an unsuccessful Win32 call -- this time you should not have a problem either, e.g.:
...
lnResult = AlphaBlend (hDC, lnX,lnY, lnWidth,lnHeight,;
hMemDC, 0,0, lnWidth,lnHeight,;
lnAlphaBlend)

IF lnResult = 0
* 6 = The handle is invalid
* 87 = The parameter is incorrect
? "Error:", GetLastError()
ENDIF
...

* * *
If I am still missing your point, please give more details.
Regards!
Anatoliy Mogylevets
http://www.news2news.com/vfp
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform