初学者问题:怎样将BSTR类型转化为CString类型? _variant_t TheValue; CString tmp="";tmp=(char*)(_bstr_t)TheValue; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 BSTR bstrstr;//这是你要转换的BSTR变量LPCOLESTR szFromBSTR;szFromBSTR=bstrstr;int nLen;nLen=WideCharToMultiByte(CP_ACP,0,szFromBSTR,-1,NULL,NULL,NULL,NULL)LPSTR szNewStdString;//这是转换的结果变量szNewStdString=(char)malloc(nLen);WideCharToMultiByte(CP_ACP,0,szFromBSTR,-1,szNewStrString,nLen,NULL,NULL);//就这样. CString BSTR2CString(BSTR str){ _bstr_t strTemp(str,TRUE); CString strRet = strTemp; return strRet;} 调用ATL为什么接口指针对象是空的? 在线等,vc内存不足 怎样动态改变一个控件的大小?? 请问哪位有《visual c++ 网络高级编程》的源码给我发一下,谢谢 哪里可以找到FAX Service provider API的例子 函数指针真难懂!(在线等待) 新装的系统老是死机!!!那是怎么回事? 有个小小问题 变量生命周期的疑问 一个关于cdc 的问题请帮忙 怎样得到硬盘上的所有可用空间 结构数组可以排序吗?
LPCOLESTR szFromBSTR;
szFromBSTR=bstrstr;
int nLen;
nLen=WideCharToMultiByte(CP_ACP,0,szFromBSTR,-1,NULL,NULL,NULL,NULL)
LPSTR szNewStdString;//这是转换的结果变量
szNewStdString=(char)malloc(nLen);
WideCharToMultiByte(CP_ACP,0,szFromBSTR,-1,szNewStrString,nLen,NULL,NULL);
//就这样.
{
_bstr_t strTemp(str,TRUE);
CString strRet = strTemp;
return strRet;
}