Re: CString help
I can explain it better. Basically, if you use FormatMessage rather than
Format your argument string tokens are represented as %1, %2, %3 rather than
things like %s %c %d. You would mostly do strings, but you can also do
numbers with a format like %1!d!. The advantage is when you call
FormatMessage() the arguments to the function remain positional, but the
tokens can be rearranged depending on language use. For example: in English
the order might be "XXX: %1 %2 %3", but in Spanish it might be "%2 %3 %1 :
XXX". The format can change, but you don't have to change the code. In the
Format/printf paradigm you sould have to actually change the argument
sequence as the tokens (%s, %d, %c, ...) are not positional.
In the case of FormatMessage the above example:
IDS_FORMATRESOURCE "XXX: %1 %2 %3"
CString cs;
cs.FormatMessage(IDS_FORMATERESOURCE,csDate, csTime, csOption);
There would be another version of IDS_FORMATRESOURCE in each language
satellite DLL.
Joe's tutorial might be interesting to you also:
http://www.flounder.com/formatmessage.htm
Tom
"jp2code" <poojo.com/mail> wrote in message
news:O$bmoAOtHHA.3400@TK2MSFTNGP03.phx.gbl...
Mr. Serface,
Do you have a little tutorial describing what you're talking about?
Regards,
Joe
"Tom Serface" <tom.nospam@camaswood.com> wrote in message
news:1E49DC41-823B-4232-A50F-2EC5D8991ABC@microsoft.com...
Hi Mihai,
Nice to see you back.
This is true unless the string came from somewhere during runtime (like
the string from a system error).
That said, I try to put every string possible (often even format strings)
in the resource editor and use the FormatMessage version using %1 %2,
etc. so that the translator can simply switch the order of the parameters
at runtime. Very convenient.
Tom
"Mihai N." <nmihai_year_2000@yahoo.com> wrote in message
news:Xns9956E379515C8MihaiN@207.46.248.16...
And even better:
AfxMessageBox(IDS_STRING_TEST);
You don't put on screen something that is not stored in resources,
right?
(I know, the exception is if the string is used for a FormatMessage
before)