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 的最大長度是多少?
uj5u.com熱心網友回復:
CRichEditCtrl::GetLimitTextlong GetLimitText( ) const;
Return Value
The current text limit, in bytes, for this CRichEditCtrl object.
Remarks
Call 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.
uj5u.com熱心網友回復:
對 edit// otherwise only 0xFFFFF=1048575 bytes can be show!
GetEditCtrl().SetLimitText(0x00400000);
uj5u.com熱心網友回復:
使用 GetTextLength() m_RichEdit.GetTextLength();CRichEditCtrl::GetTextLength()
uj5u.com熱心網友回復:
Cstring::GetLength()有些蛋疼,如果是多位元組字符集,回傳的是字串的位元組數(如“中國123”,回傳7)
如果是Unicode則回傳的字符數(如“中國123”,回傳5)
uj5u.com熱心網友回復:
檢索文本的長度,在字符,本 CRichEditCtrl 物件,不包括終止null字符)。轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/65472.html
標籤:基礎類
