windows_programming_notes.nbk: Home | Index | Next Page: Edit Control Float Subclass | Previous Page: DrawText
 Edit Control Default Message Processing
The window procedure for the predefined edit control window class carries out default processing for all messages that the edit control procedure does not process. When the edit control procedure returns FALSE for any message, the predefined window procedure checks the messages and carries out the following default actions. 
-  Message Default action
 -  EM_CANUNDO
 
Returns TRUE if the edit control operation can be undone. 
 EM_CHARFROMPOS 
Returns the character index and line index of the character nearest the specified point. 
 EM_EMPTYUNDOBUFFER 
Empties the undo buffer and sets the undo flag retrieved by the EM_CANUNDO message to FALSE. The system automatically clears the undo flag whenever the edit control receives a WM_SETTEXT or EM_SETHANDLE message. 
 EM_FMTLINES 
Adds or removes soft line-break characters (two carriage returns and a line feed) to the ends of wrapped lines in a multiline edit control. It is not processed by single-line edit controls. 
 EM_GETFIRSTVISIBLELINE 
Returns the zero-based index of the first visible character in a single-line edit control or the zero-based index of the uppermost visible line in a multiline edit control. 
 EM_GETHANDLE 
Returns a handle identifying the buffer containing the multiline edit control's text. It is not processed by single-line edit controls. 
 EM_GETLIMITTEXT 
Returns the current text limit, in characters. 
 EM_GETLINE 
Copies characters in a single-line edit control to a buffer and returns the number of characters copied. In a multiline edit control, retrieves a line of text from the control and returns the number of characters copied. 
 EM_GETLINECOUNT 
Returns the number of lines in the edit control. 
 EM_GETMARGINS 
Returns the widths of the left and right margins. 
 EM_GETMODIFY 
Returns a flag indicating whether the content of an edit control has been modified. 
 EM_GETPASSWORDCHAR 
Returns the character that edit controls use in conjunction with the ES_PASSWORD style. 
 EM_GETRECT 
Returns the coordinates of the formatting rectangle in an edit control. 
 EM_GETSEL 
Returns the starting and ending character positions of the current selection in the edit control. 
 EM_GETTHUMB 
Returns the position of the scroll box in the vertical scroll bar in a multiline edit control. 
 EM_GETWORDBREAKPROC 
Returns the address of the current Wordwrap function in an edit control. 
 EM_LINEFROMCHAR 
Returns the zero-based number of the line in a multiline edit control that contains a specified character index. This message is the reverse of the EM_LINEINDEX message. It is not processed by single-line edit controls. 
 EM_LINEINDEX 
Returns the character of a line in a multiline edit control. This message is the reverse of the EM_LINEFROMCHAR message. It is not processed by single-line edit controls. 
 EM_LINELENGTH 
Returns the length, in characters, of a single-line edit control. In a multiline edit control, returns the length, in characters, of a specified line. 
 EM_LINESCROLL 
Scrolls the text vertically in a single-line edit control or horizontally in a multiline edit control (when the control has the ES_LEFT style). The lParam parameter specifies the number of lines to scroll vertically, starting from the current line. The wParam parameter specifies the number of characters to scroll horizontally, starting from the current character. 
 EM_POSFROMCHAR 
Returns the client coordinates of the specified character. 
 EM_REPLACESEL 
Replaces the current selection with the text in an application-supplied buffer, sends the parent window EN_UPDATE and EN_CHANGE messages, and updates the undo buffer. 
 EM_SCROLL 
Scrolls the text vertically in a multiline edit control. This message is equivalent to sending a WM_VSCROLL message to the edit control. It is not processed by single-line edit controls. 
 EM_SCROLLCARET 
Scrolls the caret into view in an edit control.  
 EM_SETFONT 
Unsupported. 
 EM_SETHANDLE 
Sets a handle to the memory used as a text buffer, empties the undo buffer, resets the scroll positions to zero, and redraws the window. 
 EM_SETLIMITTEXT 
Sets the maximum number of characters the user may enter in the edit control. 
Windows NT/2000/XP: For single-line edit controls, this value is either 0x7FFFFFFE or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either –1 or the value of the wParam parameter, whichever is smaller.
Windows 95/98/Me: For single-line edit controls, this value is either 0x7FFE or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either 0xFFFF or the value of the wParam parameter, whichever is smaller.
 EM_SETMARGINS 
Sets the widths of the left and right margins, and redraws the edit control to reflect the new margins. 
 EM_SETMODIFY 
Sets or clears the modification flag to indicate whether the edit control has been modified. 
 EM_SETPASSWORDCHAR 
Defines the character that edit controls use in conjunction with the ES_PASSWORD style. 
 EM_SETREADONLY 
Sets or removes the read-only style (ES_READONLY) in an edit control. 
 EM_SETRECT 
Sets the formatting rectangle for the multiline edit control and redraws the window. It is not processed by single-line edit controls. 
 EM_SETRECTNP 
Sets the formatting rectangle for the multiline edit control but does not redraw the window. It is not processed by single-line edit controls. 
 EM_SETSEL 
Selects a range of characters in the edit control by setting the starting and ending positions to be selected. 
 EM_SETTABSTOPS 
Sets tab-stop positions in the multiline edit control. It is not processed by single-line edit controls. 
 EM_SETWORDBREAKPROC 
Replaces the default Wordwrap function with an application-defined Wordwrap function. 
 EM_UNDO 
Removes any text that was just inserted or inserts any deleted characters and sets the selection to the inserted text. If necessary, sends the EN_UPDATE and EN_CHANGE notification messages to the parent window. 
 WM_CHAR 
Writes a character to the single-line edit control and sends the EN_UPDATE and EN_CHANGE notification messages to the parent window. Writes a character to the multiline edit control. Handles the accelerator keys for standard functions, such as CTRL+C for copying and CTRL+V for pasting. In multiline edit controls, also processes TAB, and CTRL+TAB keystrokes to move among the controls in a dialog box and to insert tabs into multiline edit controls. Uses the MessageBeep function for illegal characters. 
 WM_CLEAR 
Clears the current selection, if any, in an edit control. If there is no current selection, deletes the character to the right of the caret. If the user presses the SHIFT key, this cuts the selection to the clipboard, or deletes the character to the left of the caret when there is no selection. If the user presses the CTRL key, this deletes the selection, or deletes to the end of the line when there is no selection. 
 WM_COPY 
Copies text to the clipboard unless the style is ES_PASSWORD, in which case the message returns zero. 
 WM_CREATE 
Creates the edit control and notifies the parent window with TRUE for success or –1 for failure. 
 WM_CUT 
Cuts the selection to the clipboard, or deletes the character to the left of the cursor if there is no selection. 
 WM_ENABLE 
Causes the rectangle to be redrawn in gray for single-line edit controls. Returns the enabled state for single-line and multiline edit controls. 
 WM_ERASEBKGND 
Fills the multiline edit control window with the current color of the edit control. 
 WM_GETDLGCODE 
Returns the following values: DLGC_WANTCHARS, DLGC_HASSETSEL, and DLGC_WANTARROWS. In multiline edit controls, it also returns DLGC_WANTALLKEYS. If the user presses ALT+BACKSPACE, it also returns DLGC_WANTMESSAGE. 
 WM_GETFONT 
Returns the handle of the font being used by the control, or NULL if the control uses the system font. 
 WM_GETTEXT 
Copies the specified number of characters to a buffer and returns the number of characters copied. 
 WM_GETTEXTLENGTH 
Returns the length, in characters, of the text in an edit control. The length does not include the null- terminating character. 
 WM_HSCROLL 
Scrolls the text in a multiline edit control horizontally and handles scroll box movement. 
 WM_KEYDOWN 
Performs standard processing of the virtual-key codes. 
 WM_KILLFOCUS 
Removes the keyboard focus of an edit control window, destroys the caret, hides the current selection, and notifies the parent window that the edit control has lost the focus. 
 WM_LBUTTONDBLCLK 
Clears the current selection and selects the word under the cursor. If the SHIFT key is depressed, extends the selection to the word under the cursor. 
 WM_LBUTTONDOWN 
Changes the current insertion point. If the SHIFT key is depressed, extends the selection to the position of the cursor. In multiline edit controls, also sets the timer to automatically scroll when the user holds down the mouse button outside the multiline edit control window. 
 WM_LBUTTONUP 
Releases the mouse capture and sets the text insertion point in the single-line edit control. In a multiline edit control, also kills the timer set in the WM_LBUTTONDOWN message. 
 WM_MOUSEMOVE 
Changes the current selection in the single-line edit control, if the mouse button is down. In a multiline edit controls, also sets the timer to automatically scroll if the user holds down the mouse button outside the multiline edit control window. 
 WM_NCCREATE 
Pointer to the CREATESTRUCT structure for the window. This message is sent to the WM_CREATE message when a window is first created. 
 WM_NCDESTROY 
Frees all memory associated with the edit control window, including the text buffer, undo buffer, tab-stop buffer, and highlight brush. 
 WM_PAINT 
Erases the background, fills the window with the current color of the edit control window, draws the border (if any), sets the font and draws any text, and shows the text-insertion caret. 
 WM_PASTE 
Pastes text from the clipboard into the edit control window at the caret position. 
 WM_SETFOCUS 
Sets the keyboard focus of an edit control window (shows the current selection, if it was hidden, and creates the caret). 
 WM_SETFONT 
Sets the font and optionally redraws the edit control. 
 WM_SETTEXT 
Copies text to the single-line edit control, notifies the parent window when there is insufficient memory, empties the undo buffer, and sends the EN_UPDATE and EN_CHANGE notification messages to the parent window. In multiline edit controls, also rewraps the lines (if necessary) and sets the scroll positions. 
 WM_SIZE 
Changes the size of the edit control window and ensures that the minimum size accommodates the height and width of a character. 
 WM_SYSCHAR 
Returns TRUE if the user presses ALT+BACKSPACE; otherwise takes no action. 
 WM_SYSKEYDOWN 
Undoes the last action if the user presses ALT+BACKSPACE; otherwise takes no action. 
 WM_TIMER 
Scrolls the text in the edit control window if the user holds down the mouse button outside the multiline edit control window. 
 WM_UNDO 
Removes any text that was just inserted or inserts any deleted characters and sets the selection to the inserted text. If necessary, sends the EN_UPDATE and EN_CHANGE notification messages to the parent window. 
 WM_VSCROLL 
Scrolls a multiline edit control vertically and handles scroll box movement. It is not processed by single-line edit controls. 
The predefined edit control window procedure passes all other messages to the DefWindowProc function for default processing.
windows_programming_notes.nbk: Home | Index | Next Page: Edit Control Float Subclass | Previous Page: DrawText
Notebook exported on Monday,  7 July 2008, 18:56:50 PM Eastern Daylight Time