Declare Integer GetLastError In kernel32.dll as GetLastError Declare Integer FormatMessage In kernel32.dll as FormatMessage ; Integer dwFlags, ; String @lpSource, ; Integer dwMessageId, ; Integer dwLanguageId, ; String @lpBuffer, ; Integer nSize, ; Integer Arguments lcErrorTxt = ApiError() ? lcErrorTxt ..... FUNCTION ApiError Local lcErrBuffer, lcErrorMess, liNewErr, lnErrorCode lcErrBuffer = REPL(CHR(0),1000) lnErrorCode = GetLastError() liNewErr = FormatMessage(0x1000; ,.NULL., lnErrorCode, 0, @lcErrBuffer,500,0) lcErrorMess = Transform(lnErrorCode) + " " + LEFT(lcErrBuffer, AT(CHR(0),lcErrBuffer)- 1 ) RETURN lcErrorMess< snip >