CRichEditCtrl :: GetLine功能不适用于Charaters< 4 [英] CRichEditCtrl::GetLine funtion is not working for Charaters < 4
查看:70
vcgeneral
本文介绍了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);
}
解决方案
使用足够大的缓冲区以确保ENSURE不会导致例外。
$
由于MFC代码在缓冲区的开头存储一个包含nMaxLength的int,因此接收缓冲区的最小大小必须至少为a的大小。 。INT&NBSP;这与EM_GETLINE消息的要求有关。
$
此外,请参阅
https://msdn.microsoft.com/en-us/library/z0z83tcz(v = VS.90)的.aspx
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); }
解决方案Use a buffer that is large enough to make sure that ENSURE doesn't cause an exception.
Since the MFC code stores an int containing nMaxLength at the beginning of the buffer the minimum size of the receiving buffer must be at least the size of an int. This is related to the requirements of the EM_GETLINE message.
Also, see the Note about buffer size at https://msdn.microsoft.com/en-us/library/z0z83tcz(v=vs.90).aspx
这篇关于CRichEditCtrl :: GetLine功能不适用于Charaters< 4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文
相关文章
- 删除功能不适用于angularJS;
- jQuery单击功能不适用于Firefox;
- 搜索功能不适用于特定用户;
- 要求功能不适用于图像反应;
- MxCodec解码功能不适用于XML;
- PHP SMTP邮件功能不适用于phpmailer;
- Jquery点击功能不适用于动态元素;
- OnEdit功能不适用于共享用户;
- iOS:自动调整功能不适用于UIImageView;
- 包含GuiControl的功能不适用于热键;
- Ajax成功功能不适用于android webview;
- 要求功能不适用于反应中的图像;
- ajax成功功能不适用于数据表;
- jQuery自动完成功能不适用于Turbolinks;
- Chrome自动填充功能不适用于特定页面;
- 输入功能不适用于Vscode中的python;
- PyCharm 自动完成功能不适用于 pygame;
- 物料自动完成功能不适用于InputProps;
- 注销功能不适用于ASP.NET身份;
- 自动完成功能不适用于文本框;
- 很少有功能不适用于HTML5;
- PDO准备带问号的功能不适用于数字;
- C# 6.0 功能不适用于 Visual Studio 2015;
- 熊猫爆炸功能不适用于字符串列列表;
- jQuery调整大小功能不适用于页面加载;
其他开发语言最新文章
- 成功安排的软件保护服务,以便重新启动:原因:RulesEngine。;
- 如何解决“我们很抱歉......”但您的计算机或网络可能正在发送自动查询。为了保护我们的用户,我们目前无法处理您的请求。“;
- golang无效操作:type interface {}不支持索引;
- 如何在Visual Studio 2019中创建EXE文件;
- 关于“Add-AppxPackage”的问题powershell命令;
- Windows x64 RabbitMQ安装错误与Erlang环境var(ERLANG_HOME);
- CMAKE_C_COMPILER不是现有编译器工具的完整路径;
- 在Go中将float64转换为int;
- 显示设置 - 屏幕分辨率 - 无法从远程会话更改;
- 使用Twitter登录时出错;