int GetLength() const throw()
{
return( GetData()->nDataLength );
}
struct CStringData
{
IAtlStringMgr* pStringMgr;  // String manager for this CStringData
int nDataLength;  // Length of currently used data in XCHARs (not including terminating null)
int nAllocLength;  // Length of allocated data in XCHARs (not including terminating null)
long nRefs;     // Reference count: negative == locked
// XCHAR data[nAllocLength+1]  // A CStringData is always followed in memory by the actual array of character data
}
我是使用Rich Edit 2.0这个控件,想要得到这里面字符串的长度,但感觉老有问题
Rich Edit 2.0 的最大长度是多少?

解决方案 »

  1.   

    CRichEditCtrl::GetLimitText
    long GetLimitText( ) const;Return ValueThe current text limit, in bytes, for this CRichEditCtrl object.ResCall this member function to get the text limit for this CRichEditCtrl object. The text limit is the maximum amount of text, in bytes, the rich edit control can accept.
      

  2.   

    对 edit
    // otherwise only 0xFFFFF=1048575 bytes can be show!
    GetEditCtrl().SetLimitText(0x00400000);
      

  3.   

    使用 GetTextLength()  m_RichEdit.GetTextLength();
    CRichEditCtrl::GetTextLength()
      

  4.   

    Cstring::GetLength()有些蛋疼, 
    如果是多字节字符集,返回的是字串的字节数(如“中国123”,返回7)
    如果是Unicode则返回的字符数(如“中国123”,返回5)
      

  5.   

    检索文本的长度,在字符,本 CRichEditCtrl 对象,不包括终止null字符)。