From: MikeBz on
"Joseph M. Newcomer" wrote:

> SetWindowText has nothing to do with rtf formatting. You have to use the StreamIn and
> StreamOut methods to get rtf conversions.

I think the StreamIn/Out business is a red herring. Using SetWindowText()
in a non-Unicode app does work, the RTF gets displayed as you'd expect. In a
Unicode app it doesn't make any difference whether you use SetWindowText() or
set up an EDITSTREAM and use StreamIn, if you mix Unicode and RTF (pass
SF_RTF|SF_UNICODE to StreamIn) then the RTF info in your string is displayed
rather than interpreted as formatting. I guess this isn't suprising since
RTF is ANSI based.

I have a bunch of RTF strings in a resource string table which get put at
runtime into an encapsulated CRichEditCtrl, so it looks as though in a real
Unicode world that just isn't going to work. I'm guessing I'll have to
convert my Unicode/RTF 'hybrid' strings into true RTF with the genuine 2-byte
characters escaped in some way. Probably. Hmm.

Mike
From: David Ching on
"MikeBz" <MikeBz(a)discussions.microsoft.com> wrote in message
news:FED59F9C-F14C-4AA5-9E80-F288D5596154(a)microsoft.com...
> I think the StreamIn/Out business is a red herring.
>
Yes, it looks like it to me also.


> I have a bunch of RTF strings in a resource string table which get put at
> runtime into an encapsulated CRichEditCtrl, so it looks as though in a
> real
> Unicode world that just isn't going to work. I'm guessing I'll have to
> convert my Unicode/RTF 'hybrid' strings into true RTF with the genuine
> 2-byte
> characters escaped in some way. Probably. Hmm.
>

Mike, if CRichEditCtrl is bound and determined to display Ansi strings,
wouldn't it be easier to give it what it wants and keep your RTF strings
Ansi even in the UNICODE version of your app? Nothing says each and every
string in a UNICODE app needs to be UNICODE.... And there seems to be
justification for this, since the Windows Write app itself doesn't support
Unicode RTF!

-- David (MVP)


From: MikeBz on
"David Ching" wrote:

> Mike, if CRichEditCtrl is bound and determined to display Ansi strings,
> wouldn't it be easier to give it what it wants and keep your RTF strings
> Ansi even in the UNICODE version of your app? Nothing says each and every
> string in a UNICODE app needs to be UNICODE....

Well... part of the point of converting the app to UNICODE is to give us the
capability to do foreign language versions which may need UNICODE.

I think the simplest thing will just be to drop the formatting from my
strings, I was only using RTF to do a bit of bold & italic here and there to
emphasise certain words.

Regards,

Mike
From: David Ching on
"MikeBz" <MikeBz(a)discussions.microsoft.com> wrote in message
news:E1F14DD2-DCCD-47D9-8595-7698AB265806(a)microsoft.com...
> Well... part of the point of converting the app to UNICODE is to give us
> the
> capability to do foreign language versions which may need UNICODE.
>

But if Windows Write doesn't generate Unicode RTF files, what does that say
about whether it's possible?


> I think the simplest thing will just be to drop the formatting from my
> strings, I was only using RTF to do a bit of bold & italic here and there
> to
> emphasise certain words.
>

If you're just displaying info and not having the user edit it, you may want
to use the WebBrowser control instead and show HTML.

-- David (MVP)



From: MikeBz on

"David Ching" wrote:

> But if Windows Write doesn't generate Unicode RTF files, what does that say
> about whether it's possible?

I'm using the resource editor in Visual Studio 2005. The RTF encoding is
just done by hand, e.g. I could create an entry in the string table which
says "{\\rtf1 This is \\b bold \\b0.}". A translator may use any of the
tools out there which allow the resources in an exe or dll to be translated.

> If you're just displaying info and not having the user edit it, you may want
> to use the WebBrowser control instead and show HTML.

I suspected that I might have to go down that route at some point.

Thanks for your help,

Mike