An entry field is always owned by another window. A WM_CONTROL notification message is sent to the owner whenever an event occurs in the entry field. This message contains a notification code that specifies the exact nature of the event. An entry field can send the notification codes described in the following table to its owner.
┌────────────────────┬────────────────────────────────────────┐ │Notification Code │Description │ ├────────────────────┼────────────────────────────────────────┤ │EN_CHANGE │Indicates that the contents of an entry │ │ │field have changed. │ ├────────────────────┼────────────────────────────────────────┤ │EN_INSERTMODETOGGLE │Indicates that the insert mode has been │ │ │toggled. │ ├────────────────────┼────────────────────────────────────────┤ │EN_KILLFOCUS │Indicates that an entry field has lost │ │ │the keyboard focus. │ ├────────────────────┼────────────────────────────────────────┤ │EN_MEMERROR │Indicates that an entry field cannot │ │ │allocate enough memory to perform the │ │ │requested operation, such as extending │ │ │the text limit. │ ├────────────────────┼────────────────────────────────────────┤ │EN_OVERFLOW │Indicates that either the user or the │ │ │application attempted to exceed the text│ │ │limit. │ ├────────────────────┼────────────────────────────────────────┤ │EN_SCROLL │Indicates that the text in an entry │ │ │field is about to scroll. │ ├────────────────────┼────────────────────────────────────────┤ │EN_SETFOCUS │Indicates that an entry field received │ │ │the keyboard focus. │ └────────────────────┴────────────────────────────────────────┘
An application typically ignores notification messages from an entry field, thereby allowing default text editing to occur. For more specialized uses, an application can use notification messages to filter input. For example, if an entry field is intended for numbers only, an application can use the EN_CHANGE notification code to check the contents of the entry field each time the user enters a non-numeric character.
As an alternative, an application can prevent inappropriate characters from reaching an entry field by using EN_SETFOCUS and EN_KILLFOCUS, in filter code, placed in the main message loop. Whenever the entry field has the keyboard focus, the filter code can intercept and filter WM_CHAR messages before the WinDispatchMsg function passes them to the entry field. An application also can respond to certain keystrokes, such as the Enter key, as long as the entry-field control has the keyboard focus.