Hi all

How do I set the charset in a RichEdit control?

This does not work. :confused:

;Set font charset
mov cf.cbSize,sizeof cf
mov cf.dwMask,CFM_CHARSET
mov al,lfnt.lfCharSet
mov cf.bCharSet,al
invoke SendMessage,hWin,EM_SETCHARFORMAT,SCF_ALL,addr cf

Posted on 2002-04-01 13:56:00 by KetilO
i thought maybe this might be it. or maybe you already have filled the structure info somewhere in your code already..

mov  cf.cbSize,sizeof cf

mov cf.dwMask,CFM_CHARSET
mov lfnt.lfCharSet,RUSSIAN_CHARSET ;<-- maybe you forgot this line?
mov al,lfnt.lfCharSet
mov cf.bCharSet,al
invoke SendMessage,hWin,EM_SETCHARFORMAT,SCF_ALL,addr cf
Posted on 2002-04-01 16:12:58 by smurf
Hi smurf

Yes, lfnt.lfCharSet is set by ChooseFont.

Posted on 2002-04-01 16:29:45 by KetilO
ok have you checked out ewayne's richedit demo? he demonstrates the use in it. here is a direct link:


doh!! i just noticed your not sending your message to the richedit control.

change the hWin to the handle of your Richedit
Posted on 2002-04-01 16:40:28 by smurf
Hi smurf

The sniplet shown is a small part of a richedit formatting proc.
hWin is the handle to the richedit control. I even tried to send a EM_GETCHARFORMAT and the cf.bCharSet is set. :confused:

I will check out Ewains demo.

Posted on 2002-04-01 16:54:23 by KetilO
Hi all

Well, Ewaynes demo did not work either. Makes me wonder if there is something wrong with my richedit. Here is my test project. Maybe someone can test it.

Posted on 2002-04-01 17:24:29 by KetilO
what exactly do you want tested. i was able to change my font just fine.
Posted on 2002-04-01 17:53:27 by smurf
Hi smurf

When selecting font, specify Russian or any other CharSet.
Russian characters should be in the range Alt+128 an up.
I can only get the standard ansi to show in the richedit.

Posted on 2002-04-01 17:58:03 by KetilO
I checked it.
It works fine with Russian charset even when font is not changed
to Cyrrilic. :)
May be it's not right place to ask but here is one thing in RadAsm that always trapped me:
Here is option to change text and editor font.
Every time I load it (RadAsm) I see that Western charset is set.
Then I (every time) change it to Cyrrilic, but when I load it again it
is again Western charset.
Posted on 2002-04-01 18:20:00 by The Svin
Seems I got it!
Those strange effects in your reachedit with national charsets
happen(at least in my machine) when using colors!
I recalled that I had once description text in experimental project and I don't remember that I had any problems with national characters there. Now I checked - That's it!
If no color highlighting - everything works.
I would start now some project in RadAsm if I could change main
text color (it's not white enough - hard to see) if I could change it
to white for text it would be nice, I don't really kin on highlighting
so it wouldn't be a great loss for me. But I prefer black background and thus text color for me need to be one of:
bright white
bright yellow
bright green
Posted on 2002-04-01 18:39:16 by The Svin
Hi The Svin

Good, it works.
In current version of RadASM charset is not saved. Now that I have the test working I will save and restore the selected charset.

Posted on 2002-04-01 18:41:40 by KetilO
Hi The Svin

You can set text and back colors to any color you wish in RadASM.

Posted on 2002-04-01 18:46:39 by KetilO
Every time I choose color for backgroung (in not highligting mode)
it works, but when it the mode I choose text color it makes one
short flash and text color remains this blurred white.
Posted on 2002-04-01 18:59:27 by The Svin
Hi The Svin

1. Uncheck Use Hiliting
2. Select Back color
3. Select Fore color
4. Click Ok

I seem to remember a bug in eariler versions that would not set fore color properly.

Posted on 2002-04-01 19:07:50 by KetilO
I was wrong trying to set text color in the mode changing text color, should have use Fore Color instead.
Now I'll try something, be ready for feedback :)
Thank you.
Posted on 2002-04-01 19:14:53 by The Svin
Hi all

I still have problems with Russian charset in richedit (riched20.dll version 3).
When I select Russian keyboard and enter text it enters unicode.
Not at all what I wanted. Does anyone know the solution to this?

Posted on 2002-04-03 02:55:29 by KetilO