 |
FormatMessage ..msdn Add comment W32 Constants Translate this page |
 |
 |
|
The FormatMessage function formats a message string. It can be used to obtain error message strings for the system error codes returned by GetLastError. |
 |
 |
| Code examples: |
 |
|
|
 |
 |
| Declaration: |
 |
 |
DWORD FormatMessage(
DWORD dwFlags, // source and processing options
LPCVOID lpSource, // message source
DWORD dwMessageId, // message identifier
DWORD dwLanguageId, // language identifier
LPTSTR lpBuffer, // message buffer
DWORD nSize, // maximum size of message buffer
va_list *Arguments // array of message inserts
);
|
 |
 |
 |
| FoxPro declaration: |
 |
 |
DECLARE INTEGER FormatMessage IN kernel32;
INTEGER dwFlags,;
INTEGER lpSource,;
INTEGER dwMessageId,;
INTEGER dwLanguageId,;
INTEGER @ lpBuffer,;
INTEGER nSize,;
INTEGER Arguments
|
 |
 |
 |
| Parameters: |
 |
dwFlags
[in] Specifies aspects of the formatting process and how to interpret the lpSource parameter
lpSource
[in] Specifies the location of the message definition
dwMessageId
[in] Specifies the message identifier for the requested message. For obtaining system error messages put the error code into this parameter.
dwLanguageId
[in] Specifies the language identifier for the requested message
lpBuffer
[out] Pointer to a buffer for the formatted (and null-terminated) message
nSize
Maximum or minimum (depends on settings) number of bytes in the output buffer
Arguments
[in] Pointer to an array of values that are used as insert values in the formatted message
|
 |
 |
| Return value: |
 |
| If the function succeeds, the return value is the number of TCHARs stored in the output buffer |
 |
 |
| Usage: |
 |
dwFlags = FORMAT_MESSAGE_ALLOCATE_BUFFER +;
FORMAT_MESSAGE_FROM_SYSTEM +;
FORMAT_MESSAGE_IGNORE_INSERTS
* lnErr -- error code; e.g. returned by GetLastError()
lpBuffer = 0
lnLength = FormatMessage(dwFlags, 0,;
lnErr, 0, @lpBuffer, 0, 0)
|
 |
 |
| My comment: |
 |
| This function retrieves data from the MESSAGETABLE resource in KERNEL32.DLL. Most likely, the same can be accomplished with the FindResource and LoadResource calls (RT_MESSAGETABLE). |
 |
 |
| Word Index links for the FormatMessage : |
 |
|
|
 |
 |
| Translate this page: |
 |
|
 |
 |
| • |
 |
| Created: | 2001-07-21 12:00:00 | | Modified: | 2010-05-27 13:52:10 | Visited in last 7 days: 44 |