将通用文本从EditBox控件转换为_bstr_t实体 [英] conversion of a generic text from a EditBox Control into a _bstr_t entity

查看:82
本文介绍了将通用文本从EditBox控件转换为_bstr_t实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我面临一个奇怪的问题.我试图从EditBox控件中获取文本,然后尝试将该文本转换为_bstr_t实体.

我将代码用作_bstr_t bstrVariable = :: allocSysString(str);

当我这样做时,我只得到bstrVariable中的第一个字符.

请注意,str不是常量字符串(它包含一些用户可以编辑的类型化数据),否则allocSysString()可以正常工作.

因此,对此有任何帮助将不胜感激. :)

Hi,

I am facing a strange problem. I am trying to get a text from a EditBox Control, and then trying to convert that text into a _bstr_t entity.

I am using the code as _bstr_t bstrVariable = ::allocSysString(str);

and when I m doing this, I am getting only the first character in the bstrVariable.

Please note that str is not a constant string(it contains some typed data which user can edit), otherwise allocSysString() would have worked fine.

so any help on this would be appreciated. :)

推荐答案

CString str = "The string";

_bstr_t bstrTest( str );

//or

_bstr_t bstrTest = _bstr_t( str ); 


这篇关于将通用文本从EditBox控件转换为_bstr_t实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆