GetLine:从编辑控件中检取一行文本。没有文本,返回拷贝的字节数。如果nIndex参数指定的行号大于编辑控件中的参数,返回0。nIndex指定要从控件中检取的行号,为0,指定第一行。
CEdit::GetLine
int GetLine( int nIndex, LPTSTR lpszBuffer ) const;
int GetLine( int nIndex, LPTSTR lpszBuffer, int nMaxLength ) const;
Return Value
The number of bytes actually copied. The return value is 0 if the line number specified by nIndex is greater then the number of lines in the edit control.
Parameters
nIndex
Specifies the line number to retrieve from a multiple-line edit control. Line numbers are zero-based; a value of 0 specifies the first line. This parameter is ignored by a single-line edit control.
lpszBuffer
Points to the buffer that receives a copy of the line. The first word of the buffer must specify the maximum number of bytes that can be copied to the buffer.
nMaxLength
Specifies the maximum number of bytes that can be copied to the buffer. GetLine places this value in the first word of lpszBuffer before making the call to Windows.
LineIndex:检取多行控件中某一行的字符下标。如果指定行号大于编辑控件中的行数,返回-1。参数nLine表示行在编辑控件文本中的下标值或-1。为-1,指定当前行,即包含插入符的行。多行时返回指定(当前)行的字符序号 只用于多行时
索引从0开始
CEdit::LineIndex
int LineIndex( int nLine = -1 ) const;
Return Value
The character index of the line specified in nLine or –1 if the specified line number is greater then the number of lines in the edit control.
Parameters
nLine
Contains the index value for the desired line in the text of the edit control, or contains –1. If nLine is –1, it specifies the current line, that is, the line that contains the caret.
Remarks
Call this function to retrieve the character index of a line within a multiple-line edit control. The character index is the number of characters from the beginning of the edit control to the specified line.
This member function is only processed by multiple-line edit controls.
CEdit默认最大显示字符数是30000,可以使用SetLimitText 进行设置