I am attempting to get the error message that relates to the GetLastError Windows API function.
I have followed the examples given here relating to the FormatMessage function:
How to get the error message from the error code returned by GetLastError()?
My implementation is returning a string but noticed through testing that some error messages are including text such as "%1". For example, for the error code 574:
{Application Error} The exception %s (0x%08lx) occurred in the application at location 0x%08lx.
I assume that this is resolved by setting the Arguments parameter in the FormatMessage function. However, I cannot find a suitable tutorial/example for setting this parameter on system error messages. The links I have provided set this parameter to NULL.
Is this because ANY Windows API call that sets the last error message via SetLastError never uses a code that corresponds to a message that uses the Arguments parameter?
Otherwise, how do I create such a va_list for system error messages?
Aucun commentaire:
Enregistrer un commentaire