1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| EM_LINELENGTH
The 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.
To send this message, call the SendMessage function with the following parameters.
SendMessage(
(HWND) hWnd, // handle to destination window
EM_LINELENGTH, // message to send
(WPARAM) wParam, // character index
(LPARAM) lParam // not used; must be zero
);
Parameters
wParam
Specifies 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 Values
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. |
Partager