When typing into a CRichEditCtrl, EN_CHANGE messages are generated. However MSDN says:
Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. To receive EN_CHANGE notifications, specify ENM_CHANGE in the mask sent with the EM_SETEVENTMASK message. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls.
The EN_CHANGE notification is not sent when the ES_MULTILINE style is used and the text is sent through WM_SETTEXT.
I have several dialogs using a multi-line rich edit control, actually my custom CMyRichEdit
class. That class automatically performs analysis when the text changes, but in the important case where the dialog is initially populated, no notification is seen.
The point is to avoid having to change our code-base more than absolutely necessary - the new control is being dropped in to replace existing ones. Chasing down every instance where getDlgItem(IDC_EDIT)->SetWindowText
is used, or where DDX_Text(pDX, IDC_EDIT, m_strEdit)
automatically links a string contents with the control, would mean a lot of trawling through code and re-testing everything altered.
Is there an easy way? Can MyRichEdit
catch its own WM_SETTEXT
messages?