[comp.windows.misc] MS Windows -- edit controls

dianek@umd5.umd.edu (Diane Kurilecz) (10/20/88)

I've got a problem in ms-windows.

I have an edit-class window into which i am trying to open a file.
So far, so good.  However, i would like to then open an additional
file.  I can't seem to get it tacked on to the end of the current
edit control without losing what's already there.

Does anyone have any suggestions?

                       -- diane

bturner@hpcvlx.HP.COM (Bill Turner) (10/22/88)

> I have an edit-class window into which i am trying to open a file.
> So far, so good.  However, i would like to then open an additional
> file.  I can't seem to get it tacked on to the end of the current
> edit control without losing what's already there.

How are you getting the first file into the edit control?

I haven't done this myself, but I have two suggestions on how to
proceed:

1) When you are ready to append the second file, send a EM_GETHANDLE
message to the edit (which returns the local handle of its buffer),
then LocalReAlloc it to the required size and read the text onto
the end of the buffer.

2) Read the text into a block of memory, then EM_SETSEL to the end of
file (I believe that if you specify start and end as the same it moves
the cursor to that location), and EM_REPLACESEL to replace the (null)
selection with the text you've read.

(My preferences lean toward the first suggestion, since I'm not sure
if SETSEL works as I think it does...)

--Bill Turner