Converts error codes returned by various APIs in the WinGP SDK into error messages.
Returns an error message with status information attached, if possible.
EasyLoadErrorMessage() always returns the same error message as the defined error code. EasyLoadErrorMessageEx() returns more detailed information, such as the name of the communication partner, where the error occurred, and status when the error occurred. Even the same error code could return different error messages, depending on the location of the error.
EasyLoadErrorMessageEx(), EasyLoadErrorMessageExM() return a multi-byte string message (ASCII)
EasyLoadErrorMessageEx(), EasyLoadErrorMessageExM() return a string message (UNICODE)
Function Name
BOOL WINAPI EasyLoadErrorMessageEx(INT iErrorCode,LPSTR osErrorMessage);
BOOL WINAPI EasyLoadErrorMessageExW(INT iErrorCode,LPWSTR owsErrorMessage);
Argument
iErrorCode: (In) Error code returned by the WinGP SDK function
osErrorMessage: (Out) Pointer to the area where the converted string (ASCII) is stored (prepare for 1024 bytes or more.)
osErrorMessage: (Out) Pointer to the area where the converted string (UNICODE) is stored (prepare for 2048 bytes or more.)
Return value (NULL)
Successful operation: Any value other than zero
Failed to convert string (for example, unused error code): 0
Special Item
EasyLoadErrorMessage() is used to call a function in the WinGP API, and when the function returns an error code, this message is converted into a message.
The WinGP SDK remembers only one set of error status information for each handle. As a result, after an error occurs in the API, call EasyLoadErrorMessage() right away. Do not call a different API function, or else the API will overwrite the error status information and EasyLoadErrorMessage() will not return the desired error status.