Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

What's the meaning of bstr, lpolestr in winapi?


Asked by Aliyah Bernard on Dec 14, 2021 FAQ



BSTR and LPOLESTR have special meanings - they indicate the the string pointed to is allocated in a special way. String pointed to by BSTR must be allocated with SysAllocString() family functions.
Consequently,
String pointed to by BSTR must be allocated with SysAllocString () family functions. String pointed to by LPOLESTR is usually to be allocated with CoTaskMemAlloc () (this should be looked up in the documentation to the COM call accepting/returning it).
Also Know, LPTSTR and LPWSTR and similar defines are really just defines. BSTR and LPOLESTR have special meanings - they indicate the the string pointed to is allocated in a special way.
In addition,
A BSTR (Basic string or binary string) is a string data type that is used by COM, Automation, and Interop functions.
Next,
_bstr_t -- A C++ class wrapper for the Visual Basic string type CComBSTR -- Yet another C++ class wrapper for the Visual Basic string type used predominately in ATL code