• 0

Fill a tagSAFEARRAY with VARIANTs


Question

Hi!

I?m about to pass a VARIANT to a ?COM-function?.

In the API I says I should pass: an Array of VARIANTS.

How do I create the array.

I have looked at the function SafeArrayPutElement(?) and managed to pass an Array of BSTR? but I do need to pass it like an VARIANT Array?.?

Tips?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0
Hi!

I?m about to pass a VARIANT to a ?COM-function?.

In the API I says I should pass: an Array of VARIANTS.

How do I create the array.

I have looked at the function SafeArrayPutElement(?) and managed to pass an Array of BSTR? but I do need to pass it like an VARIANT Array?.?

Tips?

584802721[/snapback]

Assuming you're using C++(from MSDN):

SAFEARRAY* psa;
SAFEARRAYBOUND bnds[1];
bnds[0].lLbound = 0;
bnds[1].cElements = 5;

psa = SafeArrayCreate( VT_VARIANT, 1, bnds );
if( psa == NULL )
    return E_OUTOFMEMORY;

// use array
return NOERROR;

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.