_variant_t TheValue; 
CString tmp="";
tmp=(char*)(_bstr_t)TheValue;

解决方案 »

  1.   

    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);
    //就这样. 
      

  2.   

    CString BSTR2CString(BSTR str)
    {
      _bstr_t strTemp(str,TRUE);
      CString strRet = strTemp;
      return strRet;
    }