Retrieves the line number of the line that contains the specified character index.
Contains the zero-based index value for the desired character in the text of the edit control, or contains –1. If nIndex is –1, it specifies the current line, that is, the line that contains the caret.
A character index is the number of characters from the beginning of the rich edit control. For character counting, an OLE item is counted as a single character.
For more information, see EM_EXLINEFROMCHAR in the Platform SDK.
// The pointer to my rich edit control. extern CRichEditCtrl* pmyRichEditCtrl; // The index of the char to get information on. extern int nIndex; CString strText; pmyRichEditCtrl->GetWindowText(strText); strText = strText.Mid(nIndex, 1); // Dump the index, character and line number. TRACE("nIndex = %d, character = %c, line = %d\r\n", nIndex, strText, pmyRichEditCtrl->LineFromChar(nIndex));