Parameters for Message Win32
API Calls (Windows)
- dwFlags
- dwFlags specifies options to the
formatting process along with how to interpret the
lpSource parameter. The low order 16 bits of this
parameter are the maximum width of the line, in
characters. Possible values are:
-
- FORMAT_MESSAGE_ALLOCATE_BUFFER
- lpBuffer is a PVOID* and nSize is the
minimum size to allocate. This function will then
allocate a buffer large enough to hold the formatted
message and store the pointer to the buffer in the
location pointed to by lpBuffer. The caller should free
the buffer with LocalFree when they are done using it.
-
- FORMAT_MESSAGE_IGNORE_INSERTS
- Insert sequences in the message definition
will be ignored and passed through to the output buffer,
as is. This is useful for fetching a message for later
formatting. If this flag is set, the lpArgument parameter
is ignored.
-
- FORMAT_MESSAGE_FROM_STRING
- lpSource is a pointer to a null terminated
message definition. It can contain insert sequences, just
as the message text in the .mc
file can.
-
- FORMAT_MESSAGE_FROM_HMODULE
- lpSource is a module handle that contains
the message table resource(s) to search. If this handle
is NULL, then the current process' application image file
will be searched.
-
- FORMAT_MESSAGE_FROM_SYSTEM
- If the requested message was not found in
lpSource, or if lpSource was not examined (i.e. neither
of the preceding function will search the system message
table resource(s).
-
- FORMAT_MESSAGE_ARGUMENT_ARRAY
- If set, this parameter specifies that the
passed Arguments parameter is NOT a va_list structure,
but instead is just a point to an array of 32-bit values
that represent the arguments.
-
- FORMAT_MESSAGE_MAX_WIDTH_MAX
- The low order 8 bits specify the maximum
width of each line formatted into the output buffer. A
maximum width of zero means that no restrictions are
placed on the width, and only the line breaks in the
message definition will be placed in the output buffer.
If a non-zero value is specified, then line breaks in the
message definition text are ignored, and instead line
breaks are calculated based on the maximum width, with
white space delimited strings never being split across a
line break. Hard coded breaks in the message definition
text, that are identified by the %n escape sequence, are
always output to the output buffer.
-
- If the width specified is
FORMAT_MESSAGE_MESSAGE_MAX_WIDTH_MASK, then line breaks
in the message file are ignored and only hard coded line
breaks are kept. None are generated.
-
- lpSource
- Specifies where to retrieve the message
definition from. The type of this parameter depends upon
the settings in the dwFlags parameter.
-
- FORMAT_MESSAGE_FROM_HMODULE - lpSource is
an hModule of the module that contains the message table
to search.
-
- FORMAT_MESSAGE_FROM_STRING - lpSource is
an LPSTR that points to unformatted message tex. It will
be scanned for inserts and formatted accordingly.
- If neither of these options is specified,
then this parameter is ignored.
-
- dwMessageId
- Specifies the 32-bit message identifier
that identifies the message being requested. This
parameter is ignored if the FORMAT_MESSAGE_FROM_STRING
flag is specified.
-
- dwLanguageId
- Specifies the 32-bit message identifier
that identifies the message being requested. This
parameter is ignored if the FORMAT_MESSAGE_FROM_STRING
flag is specified.
-
- lpBuffer
- Specifies a pointer to a buffer where the
formatted message is to be written. A terminating null
byte will also be written. IF the
FORMAT_MESSAGE_ALLOCATE_BUFFER flag was specified, the
this parameter points tot a 32-bit pointer value that is
filled in by this call with a pointer allocated via
LocalAlloc to contain the text of the message.
-
- nSize
- Specifies the maximum number of bytes that
can be stored in the output buffer. This parameter is
ignored if the FORMAT_MESSAGE_ALLOCATE_BUFFER flag is
set.
-
- Arguments
- Specifies a pointer to a variable number
of arguments. These arguments are used to satisfy insert
requests in the format string. Thus, %1 in the format
string specifies the first argument in the variable
number of arguments described by the Arguments parameter;
%3 would specify the third, and so on.
-
- The interpretation of each 32-bit
arguments value depends on the formatting infomration
associated with the inset in the message definition. The
default is to treat each pointer as a point to a null
terminated string.
-
- By default, the Arguments parameter is of
type va_list, which is a language and implementation
specific data type for describing a variable number of
arguments. If you do not have a pointer of type va_list,
then specify the FORMAT_MESSAGE_ARGUMENT_ARRAY flag and
pass a pointer to an array of 32-bit values that are
input to the message formatted as the insert values.

Message Compiler - An Overview
Message Compiler - Syntax
Message WinAPI Calls
MKMSGF - Make Message File
Utility
MKMSGF - Syntax