mRichEditCtrl.SetSel(-1, -1);
#if UNICODE
SETTEXTEX SetTxtEx = {0,};
SetTxtEx.flags = ST_SELECTION;
SetTxtEx.codepage = 1200;
BOOL bRet = ::SendMessage(mRichEditCtrl.GetSafeHwnd(), EM_SETTEXTEX, (WPARAM)&SetTxtEx, (LPARAM)Message.GetBuffer());
ASSERT(bRet);
#else
mRichEditCtrl.ReplaceSel( (LPCTSTR)Message.GetBuffer());
#endif
Message.ReleaseBuffer();
//The code page used to translate the text to Unicode. If codepage is 1200 (Unicode code page), no translation is done. If //codepage is CP_ACP, the system code page is used.
博客给出了RichEditCtrl设置文本的代码。在UNICODE环境下,使用SETTEXTEX结构体和SendMessage函数设置文本;非UNICODE环境下,使用ReplaceSel方法。还提及了文本转换的代码页相关信息。
1270

被折叠的 条评论
为什么被折叠?



