How to handle an array of Variants? 
Author Message
 How to handle an array of Variants?

Hi,
A call to method returns and array of Variants, can I use a  CComVariant to
store these values and if yes how do i do it.
eg
IDL contains
      [id(0x00000006), helpstring("Get an array containing all keys in the
dictionary."), helpcontext(0x00214b3f)]
        HRESULT Keys([out, retval] VARIANT* pKeysArray);

Since it is an out, retval type I need to allocate the array , BUT  I don't
know the size of the array....

Help....

Murtuza

CComVariant  temp;

  mixValues->Keys (&temp);



Sun, 07 Dec 2003 01:28:04 GMT  
 How to handle an array of Variants?
It is an [out] parameter so the callee is responsible for allocating memory:

CComVariant varResult;
mixValues->Keys (&varResult);
ATLASSERT(V_VT(&varResult) == VT_VARIANT | VT_ARRAY);
SAFEARRAY *psa = V_ARRAY(&varResult);
long lBound , uBound;
SafeArrayGetLBound(psa, 1, &lBound);
SafeArrayGetUBound(psa, 1, &uBound);

--
With best wishes,
    Igor Tandetnik


Quote:
> Hi,
> A call to method returns and array of Variants, can I use a  CComVariant
to
> store these values and if yes how do i do it.
> eg
> IDL contains
>       [id(0x00000006), helpstring("Get an array containing all keys in the
> dictionary."), helpcontext(0x00214b3f)]
>         HRESULT Keys([out, retval] VARIANT* pKeysArray);

> Since it is an out, retval type I need to allocate the array , BUT  I
don't
> know the size of the array....

> Help....

> Murtuza

> CComVariant  temp;

>   mixValues->Keys (&temp);



Sun, 07 Dec 2003 01:40:38 GMT  
 How to handle an array of Variants?
Thanx....
Murtuza

Quote:
> It is an [out] parameter so the callee is responsible for allocating
memory:

> CComVariant varResult;
> mixValues->Keys (&varResult);
> ATLASSERT(V_VT(&varResult) == VT_VARIANT | VT_ARRAY);
> SAFEARRAY *psa = V_ARRAY(&varResult);
> long lBound , uBound;
> SafeArrayGetLBound(psa, 1, &lBound);
> SafeArrayGetUBound(psa, 1, &uBound);

> --
> With best wishes,
>     Igor Tandetnik



> > Hi,
> > A call to method returns and array of Variants, can I use a  CComVariant
> to
> > store these values and if yes how do i do it.
> > eg
> > IDL contains
> >       [id(0x00000006), helpstring("Get an array containing all keys in
the
> > dictionary."), helpcontext(0x00214b3f)]
> >         HRESULT Keys([out, retval] VARIANT* pKeysArray);

> > Since it is an out, retval type I need to allocate the array , BUT  I
> don't
> > know the size of the array....

> > Help....

> > Murtuza

> > CComVariant  temp;

> >   mixValues->Keys (&temp);



Sun, 07 Dec 2003 01:44:36 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How do i get size VARIANT array of VARIANTs

2. How do I convert a VARIANT array to a CString array

3. STL string to VARIANT Array (Safe Array)

4. handling an array of arrays

5. Handle VARIANT type in a dll ...

6. Variant of fgets() that can handle arbitrary length lines

7. How to pass VARIANT ARRAY to AccessibleChildren

8. - Array of Variant -

9. Sending an Array of Strings as a Variant

10. -Array of Variant -

11. Passing An Array of String or Variant

12. ActiveX - Passing variant array from VBScript & C#

 

 
Powered by phpBB® Forum Software