Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FormatMessage works fine
Message
From
03/06/1997 10:44:56
 
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
FormatMessage works fine
Miscellaneous
Thread ID:
00034721
Message ID:
00034721
Views:
87
Thanks Paul.

Here's your confirmation that the FormatMessage syntax you gave me is working.

I will create a FAQ for that tonight.

In the meantime, here is the function I have defined.

FUNCTION GetError
* Returns an error message from WIN32API
* expN1 Error message from WIN32API
PARAMETER tnError

DECLARE INTEGER GetLastError IN WIN32API

DECLARE INTEGER FormatMessage IN WIN32API;
INTEGER, INTEGER, INTEGER, INTEGER, STRING, INTEGER, INTEGER

LOCAL lnError,lcError

* If we pass an error, otherwise get it from GetLastError()
IF TYPE('tnError')='N'
lnError=tnError
ELSE
lnError=GetLastError()
ENDIF

lcError=SPACE(255)
FormatMessage(4096,0,lnError,0,@lcError,255,0)
MESSAGEBOX('Error: '+ALLTRIM(STR(lnError))+CHR(13)+CHR(13)+lcError,16)
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform