首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

关于Edit Control的小疑点

2012-01-30 
关于Edit Control的小问题怎样直接得到多行Edit控件第index行字符串的字符数? [解决办法]int GetLine( int

关于Edit Control的小问题
怎样直接得到   多行Edit控件   第index行字符串的字符数?


[解决办法]
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.

Remarks

Call this function to retrieve a line of text from an edit control and places it in lpszBuffer.

The copied line does not contain a null-termination character.

For more information, seeEM_GETLINE in the Win32 documentation.


[解决办法]
int GetLine( int nIndex, LPTSTR lpszBuffer ) const;
取nIndex行的存到lpszBuffer中。nIndex从0开始

热点排行