atl object with variant array [out] parameter do not work for vbscript 
Author Message
 atl object with variant array [out] parameter do not work for vbscript

Hello,

I have implemented an ATL object. One of the methods  returns a variant
array for an [out] parameter. As coded below:
...........
 aDim[0].lLbound = 1;
 aDim[0].cElements = result;
 psaiType = SafeArrayCreate(VT_BSTR, 1, aDim);
..........
// locationType is the out parameter
 V_VT(locationType) = VT_ARRAY | VT_BSTR;
 V_ARRAY(locationType) = psaiType;
return S_OK;

This method of the ATL object works great in Visual C++ and Visual Basic
programs.
But it does NOT work in VBScript as coded below
Dim locType, obj, i
........
obj.Method(..., locType)
For i = LBound(locType) To UBound(locType)
    Response.Write locType(i)
Next

LBound and UBound functions return correct values, whereas locType(i)
produces
"Type Mismatch" error.

Can you help me explain what is different for VBscript and how to solve it?
Thanks in advance,
-Mehmet Bayraktar



Sun, 08 Feb 2004 18:05:25 GMT  
 atl object with variant array [out] parameter do not work for vbscript
IIRC VBScript only understands SAFEARRAY of VARIANTs (which in turn can hold
BSTRs)
--
With best wishes,
    Igor Tandetnik


Quote:
> Hello,

> I have implemented an ATL object. One of the methods  returns a variant
> array for an [out] parameter. As coded below:
> ...........
>  aDim[0].lLbound = 1;
>  aDim[0].cElements = result;
>  psaiType = SafeArrayCreate(VT_BSTR, 1, aDim);
> ..........
> // locationType is the out parameter
>  V_VT(locationType) = VT_ARRAY | VT_BSTR;
>  V_ARRAY(locationType) = psaiType;
> return S_OK;

> This method of the ATL object works great in Visual C++ and Visual Basic
> programs.
> But it does NOT work in VBscript as coded below
> Dim locType, obj, i
> ........
> obj.Method(..., locType)
> For i = LBound(locType) To UBound(locType)
>     Response.Write locType(i)
> Next

> LBound and UBound functions return correct values, whereas locType(i)
> produces
> "Type Mismatch" error.

> Can you help me explain what is different for VBscript and how to solve
it?
> Thanks in advance,
> -Mehmet Bayraktar



Sun, 08 Feb 2004 23:08:50 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Passing variant array from VBScript to ATL

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

3. Returning arrays of VARIANTs to VBScript

4. ADO Recordset.GetRows() variant array to VB/VBScript Client

5. Type Info, Parameter Info Not working while mouse is over an object or method

6. creating array of objects with NOT default parameters

7. C++/ATL/ADO - Intellisense not working (statement completion options) not working

8. Testing My ATL COM Objects Not Working

9. Passing array from ATL COM to VBScript client

10. Passing array from COM object to VBScript client

11. objects as input parameters in VARIANT(newbie)

12. Add-in for VC 5.0 works in VBScript not DLL

 

 
Powered by phpBB® Forum Software