|
From: <cg...@wo...> - 2002-12-09 11:36:20
|
In the Win32 API reference it is said that the maximum text limit for a multiline edit control is 65535 characters. Things are not this way, and it should be noticed a couple of things about it. When in a simple edit control you want to retrieve the selection it's claimed in books that 65535 is the highest position that can be selected through EM_SETSEL message, and the maximum you can retrieve thorugh EM_GETSEL (with the correspondent pointings to how get them with rich edits or some other messages or variables) Yeah, this is not accurate, I've not now the info at hand and I have no will to see at it, so forget this paragraph. ;-) Good, I haven't tried it, so I trust it. But I noticed with my edit experiment (I'm back to it) that pasting the whole code for it (1126 lines) cut the text in the middle. So I send EM_GETLIMITTEXT in WM_CREATE, it was 30000, the half of the maximum. This is a datum it's not in the reference and I don't remember having read it in my book (Perhaps I forgot it). Then I send EM_SETLIMITTEXT with WPARAM set to 65535. Right, now the edit field has place for all the lines of code plus a half of it. Then I watch again at the reference, if you pass the message with 0 in the WPARAM field the limit is set to the maximum, I do the change, now EM_GETLIMITTEXT reports -1 and I paste the code up to five times and I've not reached the maximum. I scroll up checking if it is being possible at the cost the edit is deleting the begin of the text (as command window, although it mustn't be so, since with 30000 was neither) and there are the full five code repetitions. So the limit for a multiline edit control seems to default to 30000, at least in my computer, if you want to be the maximum, so high it seems unlimited, you have to set it explicitly with SendMessage(edit_window_handle, EM_SETLIMITTEXT, (WPARAM)0, (LPARAM)0);. |