• 0

How to build a SAFEARRAY?


Question

I?m about to make a SAFEARRAY and pas it into a this function:

void IAcadSelectionSet::AddItems(const VARIANT& pSelSet)
{
	static BYTE parms[] =
  VTS_VARIANT;
	InvokeHelper(0x7, DISPATCH_METHOD, VT_EMPTY, NULL, parms,
   &pSelSet);
}

At first I don?t really know why I know the pSelSet is a SAFEARRAY.

I know I have to do something like:

VARIANT var;
VariantInit( &var );
var.vt = VT_ARRAY;

But when I do then do this call:

myIAcadSelectionSet.AddItems( var );

it craches!!

Of course the array is empty but would the call crash cause of that?

I?m soon clear with the meaning of COM-calls but now I?m stucked.

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

SAFEARRAY* sfarray;

sfarray = SafeArrayCreate( ... blah blah

variant_t var;

var.vt = VT_ARRAY | VT_VARIANT;

var.parray = sfarray;

AddItems((const VARIANT&) var)

Edited by figgy
Link to comment
Share on other sites

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.