好象是ComSysFree,记不清楚了,手边没有资料查。

解决方案 »

  1.   

    有这个API吗?是不是自己写的函数啊?
      

  2.   

    BSTR bstrValue = ::SysAllocString(L"程序员"); 
    char * buf = _com_util::ConvertBSTRToString(bstrValue); 
    SysFreeString(bstrValue); 
    AfxMessageBox(buf); 
    delete(buf); 
      

  3.   

    原来是这样,谢谢masterz了! :)
      

  4.   

    按照msdn的sample试不需要释放的(Q168003):
       //compile options needed: /Gr or /Gz
       #include <comutil.h>
       int main()
       {
           char sz[]="hello";
           _bstr_t b;
           b = _com_util::ConvertStringToBSTR(sz);
           char * p = _com_util::ConvertBSTRToString(b);
           return 1;
       } 
    我两种情况都试过了,都没有memory leak (用BoundsChecker检查的)
    另外, 使用前需要加上comutil.h和comsupp.lib