Full text search for "BSTR"
- C++/(MFC)CString to BSTR . . . . 15 matches
#keywords BSTR,C++,CString,MFC
=== 'CString' to 'BSTR': ===
BSTR bstr = str.AllocSysString();
If you pass the 'BSTR' to some OLE function, this will normally free the 'BSTR' memory when done with it.
If you use the 'BSTR' by yourself, dont forget to call '::SysFreeString()' when you're done with it.
::SysFreeString(bstr);
=== 'BSTR' to 'CString': ===
You will mostly need this when you have some OLE function that returns a 'BSTR'. Such an OLE Function will basically do something like this:
HRESULT SomeOLEFunction(BSTR& bstr)
bstr = ::SysAllocString(L"Hello");
Use a temporary variable of the type '_bstr_t' to wrap the 'BSTR'. This way you handle both the 208 and make sure that you have no memory leak:
BSTR bstr;
SomeOLEFunction(bstr);
_bstr_t tmp(bstr, FALSE); //wrap the BSTR
// when tmp goes out of scope it will free the BSTRs memory
What is this BSTR thing, and how does it differ from WCHAR* ? Here is Eric's Complete Guide To BSTR Semantics.
- C++ . . . . 1 match
["/(MFC)CString to BSTR"]
- C++/(COM)IWebBrowser2와 IHTMLDocument2, IHTMLWindow2 구하기 . . . . 1 match
spWindow->execScript(varResult.bstrVal,
CComBSTR(_T("JScript")), &vtResult);
- LocalKeywords . . . . 1 match
BSTR C++ CString MFC
Found 4 matching pages out of 1201 total pages
You can also click here to search title.