Not Displaying Unicode Font in CRichEditCtrl

Hello Friend,
Sorry to disturb you.Pl.. help me in regarding..I would be very thankful..

Actually I am using CRichEditCtrl in my UNICODE compatible application where
I have properly set all the formatting of japneese font because it works
fine for the characters mapped to single byte hexa decimal values. ( I have
propely set the character set to SHIFTJIS_CHARSET and all rest parametrs)
but my programe does not undurstand when I try to store double byte hexa
decimal value to any _TCHAR pointer like _TCHAR* str = _T("\x307d") therefor
ReplaceSel() function also says no when I supply this double byte hex
value...

Pl... Help me to undursand my CRichEditCtrl to double byte hex values where
all japneese characters are mapped in the japneese font...

I am sending you the related code for this (what I have done)..

long nStart,nEnd;
CString oString (_T("UWJMG3 (SJIS)"));
_TCHAR szFaceName[50];
lstrcpy((LPTSTR)szFaceName, _T("UWJMG3 (SJIS)"));

_TCHAR* pStr = szFaceName;
char szNewFaceNameString[50];
int i = 0;
while ( *pStr != '\0')
{
BYTE bChar = LOBYTE(*pStr);
szNewFaceNameString = bChar;
pStr++;
i++;
}
szNewFaceNameString = '\0';

CString szFontFaceName = (LPCTSTR)szNewFaceNameString;

CRect rect(0,0,300,300);
if (!oRichCtrl.Create(
WS_CHILD | WS_VISIBLE | ES_MULTILINE,
rect, this, IDC_RICHEDITCTRL))
{
AfxMessageBox(_T("Problem creating rich edit control!"));
}
else
{
oRichCtrl.SetOptions(ECOOP_SET, ECO_AUTOWORDSELECTION |
ECO_AUTOVSCROLL );
}

oRichCtrl.ShowWindow(SW_SHOW);

cf.cbSize = sizeof(CHARFORMAT);
cf.dwMask = CFM_COLOR | CFM_FACE | CFM_CHARSET| CFM_SIZE;
cf.bCharSet = SHIFTJIS_CHARSET;//ARABIC_CHARSET;

lstrcpy((LPTSTR)cf.szFaceName, szFontFaceName);
cf.bPitchAndFamily = 0;// SJIS
cf.yHeight = 360;
cf.crTextColor = RGB(0,0,0);
file://cf.lcid = MAKELCID; // Pl. clear this if you can understand
it
is defined under CHARFORMAT2
BOOL bRet = FALSE;
bRet = oRichCtrl.SetSelectionCharFormat(cf);
oRichCtrl.GetSel(nStart,nEnd);
oRichCtrl.SetSel(nStart,nEnd);
oRichCtrl.ReplaceSel(_T("\x307d"));


Main problem is that it is not understanding this double byte hex value....

Thanks..
Regards
Raj
cyberbaashaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

chensuCommented:
This is an answer you won't like.

INFO: Rich Edit Control Does Not Support Unicode
http://support.microsoft.com/support/kb/articles/q128/5/58.asp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cyberbaashaAuthor Commented:
Hi Chensu,
 Thank u for ur Quick Reply.
But, we are using Windows NT4.0 SP6.
Do u have any idea, whether
RichEdit Control supports Unicode
with upstream versions.

Thanks in Advance
Raj
0
chensuCommented:
Are you using Rich Edit version 2.0? That KB article refers to Rich Edit version 1.0. Rich edit 2.0 has both ANSI and Unicode window classes, "RichEdit20A" and "RichEdit20W". In order to support Unicode, you need to use "RichEdit20W".
0
cyberbaashaAuthor Commented:
Hi chensu,
 Thank u again for ur reply.
 I have one more doubt.
 Yep, I am using RichEdit2.0
 But, how to know, that I am using
 RichEdit20W or RichEdit20A.

 Is there any way to find out that?
 If so, how can I change between these?


 Thanks in advance
 Raj
0
chensuCommented:
You may use Spy++ to check the class name. You may also use the IsWindowUnicode function to check. I think you should compile your application with UNICODE defined. Thus, the class name should be RichEdit20W.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Fonts Typography

From novice to tech pro — start learning today.