当RichEdit控件中的内容(字符串)改变时响应哪个消息?

hbb1981 2003-09-26 11:19:47
当RichEdit控件中的内容(字符串)改变时响应哪个消息?

我重载了EN_CHANGE这个消息当内容改变时都没有反应!!!但是在Edit控件中就可以!何解?
...全文
283 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
CslQy 2003-09-27
  • 打赏
  • 举报
回复
RichEdit默认情况下并不响应这个消息,如果想要用这个消息,就要在OnInitDialog中设置RichEdit的属性。
m_RichEdit.SetEventMask( m_RichEdit.GetEventMask() | ENM_CHANGE );
Davidzhuhua 2003-09-27
  • 打赏
  • 举报
回复
m_RichEdit.SetEventMask(EN_CHANGE)
vcforever 2003-09-27
  • 打赏
  • 举报
回复
更正一下,是在对话框初始化函数OnInitDialog()或是视图的初始化函数OnInitialUpdate(),不是在应用程序初始化函数中加代码!不好意思了!一时笔误!
vcforever 2003-09-27
  • 打赏
  • 举报
回复
在程序初始化函数OnInitInstance()函数中加上下面的代码就可以了!
m_ctlRichEdit.SetEventMask(m_ctlRichEdit.GetEventMask() | ENM_CHANGE);
其中参数的各种含义楼上的已经给列出来了,参考一下!

祝你成功!
wuxfBrave 2003-09-27
  • 打赏
  • 举报
回复
// Set the event mask so that the parent gets notified when the text
// of the rich edit control changes.
pmyRichEditCtrl->SetEventMask(pmyRichEditCtrl->GetEventMask() |
ENM_CHANGE);

怎么不看MSDN,下面是MSDN中列出的

ENM_CHANGE
Sends EN_CHANGE notifications.

ENM_CORRECTTEXT
Sends EN_CORRECTTEXT notifications.

ENM_DRAGDROPDONE
Sends EN_DRAGDROPDONE notifications.

ENM_DROPFILES
Sends EN_DROPFILES notifications.

ENM_IMECHANGE
Microsoft® Rich Edit 1.0 only: Sends EN_IMECHANGE notifications when the IME conversion status has changed. Only for Asian-language versions of the operating system.

ENM_KEYEVENTS
Sends EN_MSGFILTER notifications for keyboard events.

ENM_LINK
Rich Edit 2.0 and later: Sends EN_LINK notifications when the mouse pointer is over text that has the CFE_LINK and one of several mouse actions is performed.

ENM_MOUSEEVENTS
Sends EN_MSGFILTER notifications for mouse events.

ENM_OBJECTPOSITIONS
Sends EN_OBJECTPOSITIONS notifications.

ENM_PROTECTED
Sends EN_PROTECTED notifications.

ENM_REQUESTRESIZE
Sends EN_REQUESTRESIZE notifications.

ENM_SCROLL
Sends EN_HSCROLL and EN_VSCROLL notifications.

ENM_SCROLLEVENTS
Sends EN_MSGFILTER notifications for mouse wheel events.

ENM_SELCHANGE
Sends EN_SELCHANGE notifications.

ENM_UPDATE
Sends EN_UPDATE notifications.
Rich Edit 2.0 and later: this flag is ignored and the EN_UPDATE notifications are always sent. However, if Rich Edit 3.0 emulates Rich Edit 1.0, you must use this flag to send EN_UPDATE notifications.


16,551

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Creator Browser
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧