How do I put more than 32,000 characters into a rich text control?

Raymond Chen

Last time we looked at loading an entire file into a rich text control. The code runs great, until you try to use it to display a license agreement provided by your legal department, and then some paranoid user reports that they can’t read past page seven. (What, somebody reads those things?) What’s going on?

If you don’t specify otherwise, the maximum number of characters in a rich edit control is 32,767 charaters. (This limit exists for compatibility with the original rich edit control.) You can raise the limit with the EM_EXLIMITTEXT message. Therefore, we need to slip the line

SendMessage(hwnd, EM_EXLIMITTEXT, 0, -1);

into the program before it calls FillRichEditFromStream.

Next time, the mystery of rich edit printing.


Discussion is closed.

Feedback usabilla icon