I've got a simple chat program. I use "CreateWindow" function for the typing box:
chat_handle_11 = CreateWindow("EDIT", "", WS_BORDER | WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | WS_EX_CONTROLPARENT, 226, 447, 424, 23, hWnd, NULL, NULL, NULL);
SendMessage(chat_handle_11, EM_LIMITTEXT, ChatTextLimitInBox, 0L);
When I paste any text containing new line characters (using the right mouse click or ctrl+v), for example:
Test line 1 text
Test line 2 text
Test line 3 text
Only the first line is pasted to the typing window:
Test line 1 text
I'd like to change the text on-paste, to ignore new line characters:
Test line 1 text Test line 2 text Test line 3 text
I tried to handle the WM_PASTE message, unfortunately it didn't work:
switch (message)
{
case WM_PASTE:
{
MessageBox(NULL, "pasting", "pasting", MB_YESNO | MB_ICONQUESTION);
break;
}
...
The MessageBox was never shown. Is WM_PASTE the correct message in this case?
Additionally, I tried to add "ES_MULTILINE" to the CreateWindow, but then, when I attempt to paste the text containing multiple lines, no text is pasted at all, I can only hear the "beep" sound.
I know I could remove new lines by detecting for clipboard changes and then overwrite it, but this solution would "invade" users clipboard, so I don't want to use it.
I would be very appreciate any help.