Sets the text limit of an edit control. The text limit is the maximum amount of text, in TCHARs, that the user can type into the edit control. You can send this message to either an edit control or a rich edit control.
For edit controls and Microsoft Rich Edit 1.0, bytes are used. For Microsoft Rich Edit 2.0 and later, characters are used.
The EM_SETLIMITTEXT message is identical to the EM_LIMITTEXT message.
The maximum number of TCHARs the user can enter. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. This number does not include the terminating null character.
Rich edit controls: If this parameter is zero, the text length is set to 64,000 characters.
If this parameter is zero, the text length is set to 0x7FFFFFFE characters for single-line edit controls or –1 for multiline edit controls.
This parameter is not used.
This message does not return a value.
The EM_SETLIMITTEXT message limits only the text the user can enter. It does not affect any text already in the edit control when the message is sent, nor does it affect the length of the text copied to the edit control by the WM_SETTEXT message. If an application uses the WM_SETTEXT message to place more text into an edit control than is specified in the EM_SETLIMITTEXT message, the user can edit the entire contents of the edit control.
Before EM_SETLIMITTEXT is called, the default limit for the amount of text a user can enter in an edit control is 32,767 characters.
For single-line edit controls, the text limit is either 0x7FFFFFFE bytes or the value of the wParam parameter, whichever is smaller. For multiline edit controls, this value is either –1 bytes or the value of the wParam parameter, whichever is smaller.
Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. Use the message EM_EXLIMITTEXT for text length values greater than 64,000. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls.
Minimum supported client
|Windows Vista [desktop apps only]|
Minimum supported server
|Windows Server 2003 [desktop apps only]|