How can I retrieve information about what change is being made in a rich edit control when handling WM_NOTIFY? More specifically, I am confused because in the documentation for WM_NOTIFY it says that lParam points to an NMHDR structure but in the page for EN_CHANGE they say that lParam points to a CHANGENOTIFY structure. What does lParam point to exactly?
CodePudding user response:
If you read the EN_CHANGE documentation you linked to more carefully, you will notice this caveat:
https://docs.microsoft.com/en-us/windows/win32/controls/en-change--rich-edit-control-
Notifies a windowless rich edit control's host window that a change has occurred. A rich edit control sends this notification code in the form of a
WM_NOTIFYmessage.
See Windowless Rich Edit Controls for more details. And, as you noted, this message's CHANGENOTIFY struct does not conform to the standard use of WM_NOTIFY. The message carries only the RichEdit's control ID in the wParam, there is no NMHDR* in the lParam.
If you are using a windowed Rich Edit control instead (which I assume you are), then it uses the same EN_CHANGE message that standard Edit controls use:
https://docs.microsoft.com/en-us/windows/win32/controls/en-change
Sent when the user has taken an action that may have altered text in an edit control. Unlike the
EN_UPDATEnotification code, this notification code is sent after the system updates the screen. The parent window of the edit control receives this notification code through aWM_COMMANDmessage....
Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. To receive
EN_CHANGEnotification codes, specifyENM_CHANGEin the mask sent with theEM_SETEVENTMASKmessage. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls.
