Hi,
Two solutions to translate the error number into a text message. The first found on this Forum and adapted, the second translated from VB. Use the one you like the best
Code: Select all
Procedure.s GetSystemMessage(lngErrorCode.l)
MemoryID.i = AllocateMemory (255)
tchar.l = FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, #Null, lngErrorCode, 0, MemoryID, 255, #Null)
e$ = PeekS(MemoryID)
FreeMemory(MemoryID)
If tchar > 0
e$ = Trim(Left(e$, tchar))
Else
e$ = ""
EndIf
ProcedureReturn e$
EndProcedure
Code: Select all
Procedure.s GetSystemMessage(lngErrorCode.l)
strMsgBuff.STRING\s = Space(255)
tchar.l = FormatMessage_(#FORMAT_MESSAGE_FROM_SYSTEM, #Null, lngErrorCode, 0, @strMsgBuff\s, 255, #Null)
If tchar > 0
strMsgBuff\s = Trim(Left(strMsgBuff\s, tchar))
Else
strMsgBuff\s = ""
EndIf
ProcedureReturn strMsgBuff\s
EndProcedure