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

What kind of string is a bstr string?


Asked by Lachlan Barber on Dec 12, 2021 FAQ



A BSTR (Basic string or binary string) is a string data type that is used by COM, Automation, and Interop functions. Use the BSTR data type in all interfaces that will be accessed from script.
Indeed,
A BSTR (Basic string or binary string) is a string data type that is used by COM, Automation, and Interop functions.
In fact, _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
Similarly,
A BSTR is a pointer. The pointer points to the first character of the data string, not to the length prefix. BSTRs are allocated using COM memory allocation functions, so they can be returned from methods without concern for memory allocation. The following code is incorrect:
In this manner,
BSTR /C String conversions are required if: You are writing multiple language applications, such as C++ DLL's accessed by Visual Basic applications. This article deals with the following C/MFC/ATL string types: The demo project is just an MFC dialog based application with buttons for each type of conversion.