Export (0) Print
Expand All
1 out of 19 rated this helpful - Rate this topic


Visual Studio 6.0


void FormatMessage( LPCTSTR lpszFormat, ... );

void FormatMessage( UINT nFormatID, ... );



Points to the format-control string. It will be scanned for inserts and formatted accordingly. The format string is similar to run-time function http://msdn.microsoft.com/en-us/library/ms396940(v=vs.60).aspx -style format strings, except it allows for the parameters to be inserted in an arbitrary order.


The string resource identifier that contains the unformatted message text.


Call this member function to format a message string. The function requires a message definition as input. The message definition is determined by lpszFormat or from the string resource identified by nFormatID. The function copies the formatted message text to the CString, processing any embedded insert sequences if requested.

Each insert must have a corresponding parameter following the lpszFormat or nFormatID parameter. Within the message text, several escape sequences are supported for dynamically formatting the message. For a description of these escape sequences and their meanings, see the Windows http://msdn.microsoft.com/en-us/library/cc428939.aspx function in the Win32 SDK Programmer’s Reference.


CString str;
int nAsked = 5;
int nAgree = 4;

str.FormatMessage(_T("%1!d! of %2!d! developers agree: Hockey is %3%!"),
   nAgree, nAsked, _T("Best"));
ASSERT(str == _T("4 of 5 developers agree: Hockey is Best!"));

CString OverviewClass MembersHierarchy Chart

See Also   http://msdn.microsoft.com/en-us/library/cc428939.aspx , CString::LoadString, CString::Format

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft. All rights reserved.