The default limit to the amount of text a user can type in an edit is 30,000 characters. An application can change the amount of text the user can type by sending the control an EM_SETLIMITTEXT message. This message sets a hard limit to the number of bytes the user can type into an edit control, but affects neither text that is already in the control when the message is sent nor text copied to the control by the SetDlgItemText function or the WM_SETTEXT message. For example, suppose that the application uses the SetDlgItemText function to place 500 characters in an edit control, and the user also types 500 characters, for a total of 1,000 characters. If the application then sends an EM_SETLIMITTEXT message limiting user-entered text to 300 characters, the 1,000 characters already in the edit control remain there, and the user cannot add any more text. On the other hand, if the application sends an EM_SETLIMITTEXT message limiting user-entered text to 1,300 characters, the 1,000 characters remain, but the user can add 300 more characters.
When the user reaches the character limit of an edit control, Windows sends the application a WM_COMMAND message containing an EN_MAXTEXT notification message. This notification message does not mean that memory has been exhausted, but that the limit for user-entered text has been reached; the user cannot type any more text. To change this limit, an application must send the control a new EM_SETLIMITTEXT message with a higher limit.