Returning Variant Array

Results 1 to 2 of 2

Thread: Returning Variant Array

  1. #1
    Suri Guest

    Default Returning Variant Array

    Hi,<BR> I have a COM object written in ATL and I have a method in this object which takes a Variant pointer as an argument.<BR>STDMETHODIMP CPatient::GetData(VARIANT *pVariant)<BR><BR>The IDL looks like <BR>[id(6), helpstring("method GetData")] HRESULT GetData([out] VARIANT* pVariant); or i can make it<BR><BR>[id(6), helpstring("method GetData")] HRESULT GetData([out,retval] VARIANT* pVariant);<BR><BR>I am adding 2 strings of type BSTR to the pVariant-&#062;parray attribute.<BR><BR>I get a out of memory error in VB when i try to call the method.<BR><BR>The same method works fine when i store an array of longs instead of strings in the variant. <BR><BR>Please help!!!<BR>-Suri<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Returning Variant Array

    How do you declare the array that you point pVariant-&#062;parray to???<BR><BR>*THAT* array must be an array of Variant in order for VBS to call and use it.<BR><BR>In other words, something like:<BR><BR> &nbps; &nbsp; pVariant-&#062;parray = new Variant[2];<BR><BR>or something along those lines.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts