Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
List of Error Codes on MSDN
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
01025969
Message ID:
01026079
Views:
17
Hi Kevin,

That's not exactly what you've asked, though...
DO declare
FOR nIndex=1 TO 10  && TO 10000
	? nIndex, GetMessage(nIndex)
NEXT

FUNCTION GetMessage(nErrorno)
#DEFINE FORMAT_MESSAGE_ALLOCATE_BUFFER 0x100
#DEFINE FORMAT_MESSAGE_ARGUMENT_ARRAY 0x2000
#DEFINE FORMAT_MESSAGE_FROM_STRING 0x400
#DEFINE FORMAT_MESSAGE_FROM_SYSTEM 0x1000
#DEFINE FORMAT_MESSAGE_IGNORE_INSERTS 0x200
#DEFINE FORMAT_MESSAGE_MAX_WIDTH_MASK 0xFF

	LOCAL nFlags, hBuffer, nLen, cBuffer
	cBuffer=""

	* specify format parameters
	nFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER +;
		FORMAT_MESSAGE_FROM_SYSTEM +;
		FORMAT_MESSAGE_IGNORE_INSERTS

	hBuffer = 0
	nLen = FormatMessage(nFlags, 0,;
		nErrorno, 0, @hBuffer, 0, 0)

	IF nLen <> 0
		cBuffer = REPLICATE(Chr(0), 500)
		= CopyMemory(@cBuffer, hBuffer, nLen)
		= LocalFree(hBuffer)
		RETURN STRTRAN(LEFT(cBuffer, nLen), Chr(13)+Chr(10), "")
	ELSE
		RETURN "#empty#"
	ENDIF

PROCEDURE declare
	DECLARE INTEGER FormatMessage IN kernel32;
		INTEGER dwFlags, INTEGER lpSource, INTEGER dwMsgId,;
		INTEGER dwLangId, INTEGER @lpBuffer,;
		INTEGER nSize, INTEGER Arguments

	DECLARE INTEGER LocalFree IN kernel32 INTEGER hMem

	DECLARE RtlMoveMemory IN kernel32 As CopyMemory;
		STRING @dst, INTEGER src, INTEGER nLen
Previous
Reply
Map
View

Click here to load this message in the networking platform