EM_LINELENGTH message

Retrieves the length, in characters, of a line in an edit control. You can send this message to either an edit control or a rich edit control.

Parameters

wParam

The character index of a character in the line whose length is to be retrieved. If this parameter is greater than the number of characters in the control, the return value is zero.

This parameter can be -1. In this case, the message returns the number of unselected characters on lines containing selected characters. For example, if the selection extended from the fourth character of one line through the eighth character from the end of the next line, the return value would be 10 (three characters on the first line and seven on the next).

lParam

This parameter is not used.

Return value

For multiline edit controls, the return value is the length, in TCHARs, of the line specified by the wParam parameter. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. It does not include the carriage-return character at the end of the line.

For single-line edit controls, the return value is the length, in TCHARs, of the text in the edit control.

If wParam is greater than the number of characters in the control, the return value is zero.

Remarks

Use the EM_LINEINDEX message to retrieve a character index for a given line number within a multiline edit control.

Rich Edit: Supported in Microsoft Rich Edit 1.0 and later. For information about the compatibility of rich edit versions with the various system versions, see About Rich Edit Controls.

Requirements

Requirement Value
Minimum supported client
Windows Vista [desktop apps only]
Minimum supported server
Windows Server 2003 [desktop apps only]
Header
Winuser.h (include Windows.h)

See also

EM_LINEINDEX