edit得到光标所在处的行号和之前的字符个数

int i = m_Edit.CharFromPos(GetCaretPos());
 CString str;
 str.Format(_T("Point = %ld"),i);
 MessageBox(str);

 /*int n = m_Edit.CharFromPos(point);*/
 int nLineIndex = HIWORD(i);
 int nCharIndex = LOWORD(i);

 str.Format(_T("nLineIndex = %d, nCharIndex = %d/r/n"), nLineIndex, nCharIndex);
 TRACE(_T("nLineIndex = %d, nCharIndex = %d/r/n"), nLineIndex, nCharIndex);
 MessageBox(str);

你可能感兴趣的:(edit得到光标所在处的行号和之前的字符个数)