EM_GETLINE
wParam = (WPARAM) line; /* line number to retrieve */
lParam = (LPARAM) (LPSTR) lpch; /* address of buffer for line */
An application sends an EM_GETLINE message to retrieve a line of text from an edit control.
line
Value of wParam. Specifies the line number of the line to retrieve from a multiline edit control. Line numbers are zero-based; a value of zero specifies the first line. This parameter is ignored by a single-line edit control.
lpch
Value of lParam. Points to the buffer that receives a copy of the line. The first word of the buffer specifies the maximum number of bytes that can be copied to the buffer.
The return value is the number of bytes actually copied. The return value is zero if the line number specified by the line parameter is greater than the number of lines in the edit control.
The copied line does not contain a terminating null character.
This example sets the maximum size of the buffer, sends an EM_GETLINE message to get the first line of the multiline edit control, and adds a terminating null character to the end of the retrieved line:
unsigned char szBuf[128];
WORD cbText;
*(WORD *) szBuf = sizeof(szBuf) - 1; /* sets the buffer size */
cbText = (WORD) SendDlgItemMessage(hdlg, ID_MYEDITCONTROL,
EM_GETLINE,
0, /* line number */
(DWORD) (LPSTR) szBuf); /* buffer address */
szBuf[cbText] = '\0'; /* terminating null character */