michael_h
2005-02-16 12:06:41 UTC
I would like to call FormatMessage to get a text description of a
system error code as returned from GetLastError like this:
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL);
However, looking through the list of potential error codes on MSDN,
some of them contain escape codes for replaceable parameters such as
error code 106 (ERROR_SEM_USER_LIMIT):
Insert the diskette for drive %1.
As I don't know in advance the error codes I am likely to need to
handle (as they aren't often documented, such as with MoveFileEx for
example), how do I cope with any message description that might be
returned containing these escape codes?
Thanks in advance.
michael_h.
system error code as returned from GetLastError like this:
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER
| FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
(LPTSTR) &lpMsgBuf,
0,
NULL);
However, looking through the list of potential error codes on MSDN,
some of them contain escape codes for replaceable parameters such as
error code 106 (ERROR_SEM_USER_LIMIT):
Insert the diskette for drive %1.
As I don't know in advance the error codes I am likely to need to
handle (as they aren't often documented, such as with MoveFileEx for
example), how do I cope with any message description that might be
returned containing these escape codes?
Thanks in advance.
michael_h.