I have an edit control:
HWND hInput = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "",
WS_CHILD | WS_VISIBLE | WS_VSCROLL | ES_MULTILINE | ES_AUTOVSCROLL |
ES_WANTRETURN,
0, 0, 100, 100, hwnd, (HMENU)IDC_MAIN_INPUT, GetModuleHandle(NULL), NULL);
And when a button is pressed I'm getting the text from it and try to replace it with empty string:
TCHAR buff[2048];
memset(buff,0,2048);
GetWindowText(hInput, buff, 2048);
SetWindowText(hInput,"");
But after that in the edit control there is a new line left.
Any ideas how to remove this new line? Thanks in advance.
EDIT: Actually then the button is pressed it's ok, no new lines.
The edit control has a message procedure which captures the enter key and does the same thing as the button when it's pressed. Here is the procedure:
LRESULT CALLBACK SubClassProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_KEYDOWN:
switch (wParam)
{
case VK_RETURN:
TCHAR buff[2048];
memset(buff,0,2048);
GetWindowText(hInput, buff, 2048);
SetWindowText(hInput,"");
break;
}
break;
}
return CallWindowProc(DefProc, hwnd, msg, wParam, lParam);
}
But here it leaves the new line.