How to access elements of array objects in Javascript in VC ++

Source: Internet
Author: User

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

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.