Hey guys i've tryed to find how to do this the best way but it failed. So i want to ask the experts here:

How to add a new line of text to a edit control.
Example: I have alredy some text in the edibox and i want to add some text on the next line.

Thanks in advance:
~Cha0sBG

Recommended Answers

All 4 Replies

The edit box has to be created with the appropriate style to act as a multi-line text box. Look up the styles - off the top of my head I just don't have them memorized. But if the right style wasn't used at creation time - it just ain't gonna ever be a multi-line edit box.

added later - from Api CreateWindow() docs...

ES_MULTILINE Designates a multiline edit control. The default is single-line edit control.

Here would be what a CreateWindowEx() call to create such an edit control would look like...

hEdit=
CreateWindowEx
(
 WS_EX_CLIENTEDGE,
 "edit",
 "",
 WS_CHILD|WS_VISIBLE|ES_AUTOHSCROLL|ES_MULTILINE|WS_VSCROLL,
 60,80,620,24,
 hWnd,
 (HMENU)IDC_EDIT,
 ghInst,
 0
);

I just need a way to add text to it but not the

SetDlgItemText

~Cha0sBG

It wouldn't hurt to be clearer in your question then. To add additional text to a text box (multiline or otherwise), you need to retrieve the text already in the text box into a string variable/buffer within your program using GetWindowText() or some such, then concatenate your additional text onto it, then finally replace the entirety of the original text in the text box with the new.

To add additional text to a text box (multiline or otherwise), you need to retrieve the text already in the text box into a string variable/buffer

No, you don't need to retrieve the text !
It's a very old Win16-Win32 FAQ, see (Win32 grp) with EM

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.