Home > C++, VC++ > Creating SafeArray of bytes.

Creating SafeArray of bytes.

How to create a safearray of bytes…

// An array having some data
unsigned char ucBytes[2048]; 

// Create ole safe array object 
COleSafeArray cosaByteArray;

// Copy bytes to safe array
cosaByteArray.CreateOneDim( VT_UI1, sizeof( ucBytes ), ucBytes );

// Get safe array in variant form
_variant_t vtByteArray = cosaByteArray.Detach();
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: