Array objects in javascript can be accessed using indexes. For example:
VaR oarray = new array ("Zhang", "Wang", "Li ");
VaR sfirstitem = oarray [0];
If we know how to implement index attributes in VC ++, then we know how to call it.
For how to implement index attributes, see how to implement index attributes for COM component objects.
The following shows how to access the Code:
1. Obtain the specified index value
Cstring sindex; <br/> sindex. format (L "% d", (long) 0); </P> <p> _ variant_t vfirstitem = CVB: Get (parray, sindex );
2. traverse all values
Long nlength = CVB: Get (parray, l "length"); <br/> for (long I = 0; I <nlength; I ++) <br/>{< br/> cstring sindex; <br/> sindex. format (L "% d", I); </P> <p> _ variant_t vitem = CVB: Get (parray, sindex); <br/>}
For the implementation of the CVB tool class, see VC ++ development in VB (4) -- properties and methods for calling the idispatch Interface