Hey everybody!

Awhile ago I was asking about a problem with setting the text buffer of an edit control through EM_SETHANDLE. Well, it never really worked out for me and one of the reasons is that the message is apparently unsupported on win9x! only on NT platforms... but even on NT it never really worked :P

So I was wondering if anybody knew more about the edit control, such as where it stored it's pointer to the text buffer (GetWindowLong maybe?) and if I can set it 'manually' instead of through SendMessage or similar.

Right now, to access the text from an edit control I'm using GetWindowText and reading it into a buffer for another window. But I'd rather have the buffer shared directly between the edit control and the other window.

Thanks in advance
Posted on 2002-04-27 18:23:27 by chorus
according to microsoft, there is no way to share the text buffer between the control and the application, at least under Win9x.

So the main question is, do you really think, that GetWindowText and SetWindowText is too slow for your task? Maybe there are some other bottlenecks?
Posted on 2002-04-29 07:05:28 by beaster
not slow... just unnecessary...

I figure if the information is already in memory once, why allocate more memory and copy the exact same thing if I could just reference it? I only need to read it anyways (no writing).

And actually, GetWindowText works very quickly so I'm pretty happy with it, and I have sort-of fixed things so I only call it when necessary. Of course, a pointer *would* be quicker :) But now that you mention it, my program does have some other bottlenecks which probably need more attention....

I guess the only solution is programming my own edit control... but I hear that's kinda involved ;)

It's too bad that it can't be done (sharing the memory), thanks anyways though!

Until next time
Posted on 2002-04-29 08:24:44 by chorus
On NT use EM_GETHANDLE for reading text.
It works on all NT family including 2000.
And of course it's faster than GetWindowText, especially when
the buffer is large.
Method tested and havily used.
Posted on 2002-04-29 12:37:48 by The Svin
Thanks Svin!
That's actually a lot better than what I was trying to do :) I was trying to allocate the memory myself and call EM_SETHANDLE... but I guess it's easier to get the Edit control do all the work! Completely missed that :)

Posted on 2002-04-29 23:54:49 by chorus