INFO: Limits on Text in CEditView and CEditLast reviewed: March 2, 1998Article ID: Q181932 |
The information in this article applies to:
SUMMARYThe CEditView and the CEdit classes wrap the Windows edit control. These classes have limits on the amount of text that they can contain. These limits are operating-system dependent. Windows 95 has a 64 KB limit on edit controls that cannot be increased. To adjust the limit within this range, use CEdit::SetLimitText(UINT nMax), where nMax is the number of bytes in the new text limit. You can set nMax to 65535 to obtain the maximum (which is actually 64000 bytes). Windows NT has a practical, machine-dependent limit on edit controls. Users will run into this machine-dependent limit before they reach operating- system dependent limit. You can increase the limit by using SetLimitText(UINT nMax). You can set nMax to some large number such as 4111222333 to obtain the maximum your machine will allow. The practical limit is based on the computer's RAM. For example, it is possible to load 1 million very short lines of text (nearly 8 MB) into an edit control using a computer with 64 MB of RAM. Unfortunately, it may use up nearly 100 percent of the CPU power and take several minutes to load. Once it is loaded in memory, the control works slowly. If you need to use a control that is expected to contain near or over 64 KB of data, use CRichEditCtrl or CRichEditView. These classes wrap the rich edit Windows control. In both Windows 95 and Windows NT4, there is no definite limit on the amount of text that the control can hold. Theoretically, the rich edit control allows for a maximum of 4 GB of text. In practice, you can run into performance problems with even less than 1 MB of text. Files with many lines of text (not necessarily large files, because the lines can be very short) require a lot of time and CPU power to process the first time scrolling or resizing of the view window. Once the CPU has processed these actions, the control behaves normally. The maximum text that a CRichEditCtrl can hold can be changed by calling CRichEditCtrl::LimitText(). However, this will not effect any of the problems just mentioned. One possible option for storing huge amounts of text into a RichEdit control would be to only stream in the amount of text that is needed at a time. This would not be easy, because you need to handle the scrolling logic to load in the appropriate text for the position of the scrollbar thumb for this method to work. Another option is to design your own Cview-based class.
MORE INFORMATIONSome word processing sample programs that ship with Visual C++ are:
REFERENCESFor additional information, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q166132 TITLE : PRB: Dialog With RichEdit May Fail During Creation ARTICLE-ID: Q166213 TITLE : BUG: Right-Clicking CRichEditView Doesn't Activate Frame ARTICLE-ID: Q117778 TITLE : HOWTO: Change the Background Color of an MFC Edit Control ARTICLE-ID: Q155224 TITLE : PRB: Using CEdit SetModify/GetModify Returns Invalid ValuesFor additional information about writing 16-bit applications, please see the following article in the Microsoft Knowledge Base:
ARTICLE-ID: Q118308 TITLE : SAMPLE: CEdit Derived Class That Uses the Global Heap(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Philip Spory, Microsoft Corporation
|
Additional query words: CEdit CEditView CRichEditCtrl CRichEditView limit
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |