mfc >> Rich Edit Control 3 Unicode question

by Charles T » Fri, 28 Nov 2003 21:34:26 GMT

Hi there

I'm using CRichEditCtrl in my MFC Dialog application on windows XP. When I
paste certain unicode characters (such as greek, hebrew, or arabic, the
French Franc currency symbol) etc, I initally see the symbol correctly in
the control, but when the control loses focus, the unicode character gets
replaced with a '?'. I am iniitlaising the control with AfxInitRichEdit2().
Any ideas on how I can get the control to retain unicode characters ?

Thx for help.

Charles




mfc >> Rich Edit Control 3 Unicode question

by Kyle Alons » Sat, 29 Nov 2003 04:07:10 GMT


A couple things for starters:
1) Must be creating a Unicode build
2) Must have _RICHEDIT_VER defined in the project and >= 0x0200.

---------------------------------------------------
Automate your software builds with Visual Build Pro
http://www.kinook.com



AfxInitRichEdit2().





mfc >> Rich Edit Control 3 Unicode question

by Charles T » Sat, 29 Nov 2003 22:57:57 GMT

Hi Kyle

The _RICHEDIT_VER I have defined in afxwin.h is 0x0210. I am doing a unicode
build. I am using VC.NET 2003, and have WinXP SP1. The file version of
riched20.dll I have is 5.30.23.1211 and Product version is 3.0.
AfxInitRichEdit2() loads riched20.dll via LoadLibrary().

One thing I've noticed is that after I paste from character map and lose
focus on the control, the control changes the font of the pasted text to
whatever its default is (I'm not explicitly setting that). do you think that
might be where the loss of unicode info might be happening ?

Interestingly, I can successfully paste (and retain) the Euro currency
symbol (which has a 2-byte unicode code), but after pasting other symbols,
such as the Franc (and hebrew, greek & asian chars), and losing focus, the
pasted characters get changed to '?'s.

Any thoughts ?

Thanks, Charles





I
in
gets




Similar Threads

1. Rich Edit Control 3 Unicode question - The Answer

So the answer was - set the default font (using message EM_SETCHARFORMAT) to
something (like Arial) that can handle all the unicode characters. The rich
edit control by default uses the 'System' font when redrawing its text which
does not handle many unicode chars well.

Well, that was painful.

Charles


"Charles T" < XXXX@XXXXX.COM > wrote in message
news:% XXXX@XXXXX.COM ...
> Hi there
>
> I'm using CRichEditCtrl in my MFC Dialog application on windows XP. When I
> paste certain unicode characters (such as greek, hebrew, or arabic, the
> French Franc currency symbol) etc, I initally see the symbol correctly in
> the control, but when the control loses focus, the unicode character gets
> replaced with a '?'. I am iniitlaising the control with
AfxInitRichEdit2().
> Any ideas on how I can get the control to retain unicode characters ?
>
> Thx for help.
>
> Charles
>
>


2. Rich Edit Control DOES NOT support UNICODE string?

3. Rich Edit Control Question

I'm hoping someone may be able to give me a hint about how to do this:
I basically want to do the same thing that Microsoft Word does when its
spell checker ignores a suggested correction. Specifically, if I ignore a
suggestion once and then (this is the point) edit the text before or around
the misspelled word, the spell checker will remember to ignore that one
instance of that word when I run it again. So I think it must remember the
position of that particular word as the editing is occurring. But how does
it do this? I'm using a CRichEditView with a CRichEditCtrl, etc., and it's
easy enough to get character positions at various times, but updating those
positions while editing is occurring seems complicated...
Thanks for any advice!

Brad


4. Rich edit control and having a hypertext control to send the messages to windows

5. Rich edit control in a DLL?

I am mainly interested in using only the StreamIn() and StreamOut() members 
of CRichEditCtrl. Can I have this control inside a DLL without the UI? Is it 
possible to use other member functions also (may be other than the UI related 
ones)?
Any pointers to samples (if available) please?

6. Is Rich Edit 2.0 Control supported in WTL?

7. Rich Edit Control in Plain Text Mode

I have trouble to make it work. I am trying to set a plain text mode on the
Rich Edit Control.
It ignores me however and acts Rich anyway.

Thanks in advance if anyone can see a problem here:

// only blank control can recieve a mode change:
::SendMessage(hText, WM_SETTEXT, (WPARAM)0, (LPARAM)(LPCSTR)"");

// returns 0:
LRESULT lr = SendMessage(hText, EM_SETTEXTMODE, (WPARAM)TM_PLAINTEXT,
(LPARAM)0);	

// returns 0 - should return 1:
lr = ::SendMessage(hText, EM_GETTEXTMODE, (WPARAM)0, (LPARAM)(LPCSTR)0);




8. Rich Edit control in dialog box