EM_LIMITTEXT

This message limits the length (in bytes) of the text the user may enter.

Parameter Description  

wParam Specifies the maximum number of bytes that can be entered. If the user attempts to enter more characters, the edit control beeps and does not accept the characters. If the wParam parameter is zero, no limit is imposed on the size of the text (until no more memory is available).  
lParam Is not used.  

Comments

The EM_LIMITTEXT message does not affect text set by the WM_SETTEXT message or the buffer set by the EM_SETHANDLE message.