How to Use Rich Edit Control Notification Codes

A rich edit control's parent window can process notification codes to monitor events that affect the control. Rich edit controls support all of the notification codes that are used with edit controls, as well as several additional ones.

What you need to know

Technologies

Prerequisites

  • C/C++
  • Windows User Interface Programming

Instructions

Use a Rich Edit Control Notification Code

You can determine which notification codes 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 EM_SETEVENTMASK message. You can retrieve the current event mask for a rich edit control by using the EM_GETEVENTMASK message. For a list of event mask flags, see Rich Edit Control Event Mask Flags.

A rich edit control's parent window can filter all keyboard and mouse input to the control by processing the EN_MSGFILTER notification code. The parent window can prevent the keyboard or mouse message from being processed or can change the message by modifying the specified MSGFILTER structure.

An application can process the EN_PROTECTED notification code 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.

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

Using Rich Edit Controls

Windows common controls demo (CppWindowsCommonControls)