本文介绍了CRichEditCtrl :: GetLine功能不适用于Charaters< 4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在visual studio 2008中,当我尝试在富文本框中写入少于4个字符时,它会给出异常(下面是附件)在进行调试时,我们发现Ensure()导致异常:
int CRichEditCtrl :: GetLine(_In_ int nIndex,_Out_writes_to_(nMaxLength,return)LPTSTR lpszBuffer,_In_ int nMaxLength)const
{
ASSERT(:: IsWindow(m_hWnd));
ENSURE(sizeof(nMaxLength)< = nMaxLength * sizeof(TCHAR)&& nMaxLength> 0);
*(LPINT)lpszBuffer = nMaxLength;
return(int):: SendMessage(m_hWnd,EM_GETLINE,nIndex,(LPARAM)lpszBuffer);
}
解决方案
In visual studio 2008, When I am trying to write less than 4 characters in Rich Text Box, it gives exception (below is the attachment) After doing Debugging, we came to know that Ensure() is causing the Exception:
int CRichEditCtrl::GetLine(_In_ int nIndex, _Out_writes_to_(nMaxLength, return) LPTSTR lpszBuffer, _In_ int nMaxLength) const { ASSERT(::IsWindow(m_hWnd)); ENSURE(sizeof(nMaxLength)<=nMaxLength*sizeof(TCHAR)&&nMaxLength>0); *(LPINT)lpszBuffer = nMaxLength; return (int)::SendMessage(m_hWnd, EM_GETLINE, nIndex, (LPARAM)lpszBuffer); }
解决方案
这篇关于CRichEditCtrl :: GetLine功能不适用于Charaters< 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
08-30 05:47