Automation supports conversion between an array of bytes and a BSTR through the two low-level conversion functions VectorFromBstr and BstrFromVector, and by performing the appropriate conversions in VariantChangeType, ITypeInfo::Invoke, DispInvoke, and other relevant locations.
BSTRs are wide, double-byte (Unicode) strings on 32-bit Windows platforms, and narrow, single-byte strings on 16-bit Windows and the Apple PowerMac. These functions do not perform any special string handling. They simply move bytes from one ___location to another, so the width of strings does not affect these API functions.
In this section
Topic | Description |
---|---|
BstrFromVector |
Returns a BSTR, assigning each element of the vector to a character in the BSTR. |
SetOaNoCache |
Disables the BSTR caching in OleAut32.dll. |
VarBstrCat |
Concatenates two variants of type BSTR and returns the resulting BSTR. |
VarBstrCmp |
Compares two variants of type BSTR. |
VectorFromBstr |
Returns a vector, assigning each character in the BSTR to an element of the vector. |
Note
If these functions are passed NULL pointers, there will be an access violation and the program will crash. It is your responsibility to protect these functions against NULL pointers.