It was a waste of half a day because it didn't take a good look at the MSDN comments...
It seems that it is true that the server is not cut by mistake ..
SendMessage (
(HWND) hWnd, // handle to destination window
EM_GETLINE, // message to send
(WPARAM) wParam, // line number
(LPARAM) lParam // line buffer (LPCTSTR)
);
Parameters
WParam
Specifies the zero-based index of the line to retrieve from a multiline edit control. A value of zero specifies the topmost line. This parameter is ignored by a single-line edit control.
LParam
Pointer to the buffer that records es a copy of the line. before sending the message, set the first word of this buffer to the size, in TCHARs, of the buffer. for ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. the size in the first word is overwritten by the copied line.
Return Values
The return value is the number of TCHARs copied. The return value is zero if the line number specified by the wParam parameter is greater than the number of lines in the edit control.
Remarks
Edit controls: The copied line doesNotContain a terminating null character.
So we need to call it like this:
* (LPWORD) gBuf) = MAX_GBUF;
Int nLen = SendMessage (hWnd, EM_GETLINE, nLine, (LPARAM) gBuf );
GBuf [nLen] = '\ 0 ';