codepage is the constant that specifies the code page you want to text to be. usually, we simply use cp_acp.
text selection
we can select the text programmatically with em_setsel or em_exsetsel. either one works fine. choosing which message to use depends on the available format of the character indices. if they are already stored in a charrange structure, it's easier to use em_exsetsel.
em_exsetsel wparam == not used. must be 0 lparam == pointer to a charrange structure that contains the character range to be selected.
event notification
in the case of a multiline edit control, you have to subclass it in order to obtain the input messages such as mouse/keyboard events. richedit control provides a better scheme that will notify the parent window of such events. in order to register for notifications, the parent window sends em_seteventmask message to the richedit control, specifying which events it's interested in. em_seteventmask has the following syntax:
em_seteventmask wparam == not used. must be 0 lparam == event mask value. it can be the combination of the flags in the table below.
| enm_change | sends en_change notifications |
| enm_correcttext | sends en_correcttext notifications |
| enm_dragdropdone | sends en_dragdropdone notifications |
| enm_dropfiles | sends en_dropfiles notifications. |
| enm_keyevents | sends en_msgfilter notifications for keyboard events |
| enm_link | rich edit 2.0 and later: sends en_link notifications when the mouse pointer is over text that has the cfe_link and one of several mouse actions is performed. |
| enm_mouseevents | sends en_msgfilter notifications for mouse events |
| enm_objectpositions | sends en_objectpositions notifications |
| enm_protected | sends en_protected notifications |
| enm_requestresize | sends en_requestresize notifications |
| enm_scroll | sends en_hscroll and en_vscroll notifications |
| enm_scrollevents | sends en_msgfilter notifications for mouse wheel events |
| enm_selchange | sends en_selchange notifications |
| enm_update |
sends en_update notifications. |