Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

String concat in string resource?

56 views
Skip to first unread message

PeterD

unread,
Nov 10, 2007, 10:34:28 AM11/10/07
to
In a .RC file, is there a way to do this:


#include <winnt.h>

#define ASDF "MyProduct"

STRINGTABLE
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
BEGIN
1001, ASDF "is the best product in the world."
END

where the final result would be that string resource would have the
value: "MyProduct is a product."

I wan to customize my resource files for different products or
different text without duplication of hundreds of lines. That way, I
change the #define from "MyProduct" to "OtherProduct" for product two,
and so on and so on... <g>

I tried ## to concat but that only works in the #define directive and
not in the stringtable...

Thanks for any thoughts or suggestions!

Tom Serface

unread,
Nov 13, 2007, 1:11:23 AM11/13/07
to
I don't know of a way to do that in a .rc file, but you could certainly do
it in code easily by just using two adding to a CString. I would tend to
use a FormatMessage() and put %1 in for the product name. That way when you
localize you can move the %1 to after the text if the language calls for
that.

Tom

"PeterD" <pet...@hipson.net> wrote in message
news:rjjbj3pj5p2deguks...@4ax.com...

PeterD

unread,
Nov 13, 2007, 8:56:31 AM11/13/07
to
On Mon, 12 Nov 2007 22:11:23 -0800, "Tom Serface"
<tom.n...@camaswood.com> wrote:

>I don't know of a way to do that in a .rc file, but you could certainly do
>it in code easily by just using two adding to a CString. I would tend to
>use a FormatMessage() and put %1 in for the product name. That way when you
>localize you can move the %1 to after the text if the language calls for
>that.
>
>Tom
>
>"PeterD" <pet...@hipson.net> wrote in message

I didi end up doing it in code, but I'd hoped that I could have stuck
it in the RC file... Oh, well, that's life.

Tom Serface

unread,
Nov 13, 2007, 10:42:43 AM11/13/07
to
I think in the long run you'll be glad you did it in code. It will give you
more control over alternate translations when you decide to localize the
application.

Tom

"PeterD" <pet...@hipson.net> wrote in message

news:d7bjj393r8vis9e8v...@4ax.com...

0 new messages