0

This function works to append text to the end of the window, but I'd like it to append it with a newline/break, appending \n doesn't seem to work.

if the current text in the text box is "cat" and i append "dog" the result will be "catdog" but i want it to be:

"cat
dog"

void appendmessage(LPCTSTR newText, HWND hwnd)
{
 SendMessage(hwnd, EM_SETSEL, 0, -1); 
 SendMessage(hwnd, EM_SETSEL, -1, -1); 
 SendMessage(hwnd, EM_REPLACESEL, 0, (LPARAM)TEXT(newText)); 

}
4

1 回答 1

3

You need to append \r\n, not just \n (since this is Windows, not *nix).

于 2013-09-08T13:33:50.690 回答