FormatMessage
FormatMessage is a Windows API function that formats a message string by optionally loading the text from a system or module resource and performing inserts for arguments. It is available as FormatMessageA (ANSI), FormatMessageW (Unicode), and the generic FormatMessage macro maps to one of these depending on the build. The function is commonly used to obtain human-readable error messages corresponding to error codes from GetLastError, but it can also format messages defined in resources or supplied as strings.
The function supports several flags that control its behavior. FORMAT_MESSAGE_ALLOCATE_BUFFER tells the system to allocate the
Usage patterns are common in error handling and localization. A typical pattern is to retrieve a system
Return value is the number of TCHARs stored in the output buffer, excluding the terminating null. If