Udostępnij za pośrednictwem


Notifications from a Rich Edit Control

Notification messages report events affecting a rich edit control (CRichEditCtrl). They can be processed by the parent window or, using message reflection, by the rich edit control itself. Rich edit controls support all of the notification messages used with edit controls as well as several additional ones. You can determine which notification messages a rich edit control sends its parent window by setting its "event mask."

To set the event mask for a rich edit control, use the SetEventMask member function. You can retrieve the current event mask for a rich edit control by using the GetEventMask member function.

The following paragraphs list several specific notifications and their uses:

  • EN_MSGFILTER   Handling the EN_MSGFILTER notification lets a class, either the rich edit control or its parent window, filter all keyboard and mouse input to the control. The handler can prevent the keyboard or mouse message from being processed or can change the message by modifying the specified MSGFILTER structure.

  • EN_PROTECTED   Handle the EN_PROTECTED notification message to detect when the user attempts to modify protected text. To mark a range of text as protected, you can set the protected character effect. For more information, see Character Formatting in Rich Edit Controls.

  • EN_DROPFILES   You can enable the user to drop files in a rich edit control by processing the EN_DROPFILES notification message. The specified ENDROPFILES structure contains information about the files being dropped.

  • EN_SELCHANGE   An application can detect when the current selection changes by processing the EN_SELCHANGE notification message. The notification message specifies a SELCHANGE structure containing information about the new selection.

See Also

Concepts

Controls (MFC)

Reference

Using CRichEditCtrl