How to create SafeArray of BSTR’s?

Here is a sample to create an array of BSTR’s… [sourcecode language=’cpp’]const long lCount = 100; _bstr_t bstrArray[lCount]; COleSafeArray cosaSafeArray; cosaSafeArray.CreateOneDim( VT_BSTR, lCount ) // Fill out this array for( long lIndex = 0; lIndex < lCount; ++lIndex ) { cosaSafeArray.PutElement( &lIndex, static_cast( bstrArray[lIndex] ); } // Now you have a safe array of bstr’s and since […]
Continue reading…