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);
//就这样.
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);
//就这样.
解决方案 »
- 请教 用D3DXCreateTextureFromFileEx()出现的问题
- 求windows mobile的音乐编辑软件源码,最好是基于mfc的
- opencv提取hu不变距
- 如何判断串口COM1是否已经打开
- 用adodata控件怎么修改conncectionstring的内容?
- ★★★Wise For Windows中,安装的目录路径该用哪个变量表示★★★
- 还是Thunk的问题,实现我已经实现,不过还有些细节没弄明白。
- 对话框中的函数能调用CView类的函数吗?高分求教!不够在加!
- 加急,网络问题??
- 怎样在IE上加一个按钮啊
- 关于画图的简单问题!(不过我不会)!请求指点!!谢谢!
- 哪位高人可以提供CJ60或extreme的最新版本(含源码),在下50大洋奉上
#include<comdef.h>BSTR bsYourString;
....
_bstr_t bstrYourString = bsYourString;CString str = (LPCTSTR)bstrYourString;
or
LPCTSTR lpszStr = (LPCTSTR)bstrYourString;
#include"comutil.h"
{
char sz[]="hello";
_bstr_t b;
b = _com_util::ConvertStringToBSTR(sz);
char * p = _com_util::ConvertBSTRToString(b);
}