您的位置:首页 > 其它

VC6.0使用richedit2.0 or richedit3.0

2015-08-05 14:46 429 查看
使用原因:由于RichEdit2.0A自动为宽字符(WideChar),所以它可以解决中文乱码以及一些汉字问题

方法一:(msdn上的做法,适用于用VC.NET及以后版本创建的工程)

To update rich edit controls in existing Visual C++ applications to version 2.0,

open the .RC file as text, change the class name of each rich edit control from "RICHEDIT" to "RichEdit20a".

Then replace the call to AfxInitRichEdit with AfxInitRichEdit2.

方法二:以对话框为例:

(1) 增加一全局变量 HMODULE hMod;

(2) 在CxxxApp::InitInstance()中添加一句hMod = LoadLibrary(_T("riched20.dll"));

在CxxxApp::ExitInstance()中添加一句FreeLibrary(hMod);

(3) 在对话框上放一个richedit,文本方式打开.rc文件修改该richedit控件的类名"RICHEDIT" to "RichEdit20a".

(4) 在对话框头文件添加 CRichEditCtrl m_richedit;

在OnInitDialog中添加 m_richedit.SubclassDlgItem(IDC_RICHEDIT1, this);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: