This is happening on Vista.
I created a new dialog based MFC project to test this. I added a CEdit control to my dialog. I called SetLimitText to let my CEdit receive 100000 characters. I tried both:
this->m_cedit1.SetLimitText(100000);
UpdateData(FALSE);
and
static_cast<CEdit*>(GetDlgItem(IDC_EDIT1))->LimitText(100000);
I placed these calls on InitDialog.
after I paste 5461 characters into my CEdit, it becomes empty and unresponsive. Any ideas as to what is causing this and workarounds to be able to paste long strings of text in a CEdit or any other control?
note: 5461 is 0x1555 or 1010101010101 in binary, which i find quite odd.
if I paste 5460 characters I have no problems.
Best Answer
I contacted microsof support.
The goal was to have approximately 240000 characters in one single editable line of text.
I am able to reproduce the issue on Windows Vista (x64 and x32 both) but not on Windows XP.
this code works fine in XP:
If I use a CRichEdit control instead, when I press "end" key or "right arrow" key after pasting a long string inside, i cannot see all the characters in the Rich Edit Control. trying to scroll past the last visible character produces a beep. The rest of the characters are there, I know this because if i double-click the Rich Edit Control and copy the text using ctrl-c and then paste it on a text editor, I can see the 240000 characters. So the control is holding the right amount of characters, but the last characters are not viewable except in an external editor, so my original problem remains.
Here are the answers by microsoft representatives:
another answer from microsoft:
and the last one: