EM_LINEINDEX

2.x

EM_LINEINDEX
wParam = (WPARAM) line;   /* line number            */
lParam = 0L;              /* not used, must be zero */

An application sends an EM_LINEINDEX message to retrieve the character index of a line within a multiline edit control. The character index is the number of characters from the beginning of the edit control to the specified line.

This message is processed only by multiline edit controls.

Parameters

line

Value of wParam. Specifies the zero-based line number. A value of –1 specifies the current line number (the line that contains the caret).

Return Value

The return value is the character index of the line specified in the line parameter, or it is –1 if the specified line number is greater than the number of lines in the edit control.

Example

This example uses the EM_GETLINECOUNT message to retrieve the number of lines in an edit control and then uses EM_LINEINDEX to retrieve the character index for the last line in the edit control:

WPARAM cLines, index;

cLines = (WPARAM) SendDlgItemMessage(hdlg, ID_MYEDITCONTROL,
    EM_GETLINECOUNT, 0, 0L);
index = (WPARAM) SendDlgItemMessage(hdlg, ID_MYEDITCONTROL,
    EM_LINEINDEX, cLines - 1, 0L);

See Also

EM_LINEFROMCHAR