Code: alst=document.getElementById("ListBox1"); alst.addItem(alst,"yyyyyyyy", "666"); alst.removeItem(alst,2); asb =alst.getItems(alst); asj = new VBArray( asb ).toArray(); window.alert(asj[0]); window.alert(asj[1]); window.alert(asj[2]); window.alert(asj[3]); window.alert(asj[4]); window.alert(asj[5]); window.alert(asj[6]); window.alert(asj[7]); window.alert(asj[8]); http://msdn2.microsoft.com/en-us/library/xc634c13.aspx The conversion translates the multidimensional VBArray into a single dimensional JScript array. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^^in the idl^^ Code: [ uuid(CB35E5F2-...) ] dispinterface IMyList { ... methods: [id(5), helpstring("方法getItem")] VARIANT getItem(IDispatch* jjj, LONG kkk); }; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^^in The CPP^^ Code: BEGIN_DISPATCH_MAP(CUFList, CListBox) ... DISP_FUNCTION_ID(CUFList, "getItem", dispidgetItem, getItem, VT_VARIANT, VTS_DISPATCH VTS_I4) END_DISPATCH_MAP() VARIANT CmYList::getItem(IDispatch* ooo, LONG iii) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); USES_CONVERSION; HRESULT hr= S_OK; VARIANT * pGIV = new VARIANT; VariantInit(pGIV); // WARNING You must initialize *pVal before calling Detach // Create SafeArray of VARIANT BSTRs SAFEARRAY *pSA; SAFEARRAYBOUND aDim[1]; aDim[0].lLbound= 0; aDim[0].cElements= 3; pSA= SafeArrayCreate(VT_VARIANT,1,aDim); if (pSA != NULL) { _variant_t vOut; CString strIII; long l =0; GetText(iii,strIII); vOut= A2W(strIII); if (hr= SafeArrayPutElement(pSA, &l, &vOut)) { SafeArrayDestroy(pSA); // does a deep destroy return * pGIV; } l++; strIII.Format("%d", (int)GetItemData(iii)); vOut= A2W(strIII); if (hr= SafeArrayPutElement(pSA, &l, &vOut)) { SafeArrayDestroy(pSA); // does a deep destroy return * pGIV; } l++; strIII.Format("%d", (int)GetSel(iii)); vOut= A2W(strIII); if (hr= SafeArrayPutElement(pSA, &l, &vOut)) { SafeArrayDestroy(pSA); // does a deep destroy return * pGIV; } } V_VT(pGIV)= VT_ARRAY | VT_VARIANT; //pVal->vt= VT_ARRAY | VT_VARIANT; // oleauto.h V_ARRAY(pGIV)= pSA; // (pSA may be null) //pVal->parray= pSA; // oleauto.h return * pGIV; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^^IN THE H^^ Code: enum { dispidgetItem = 5L, ... }; VARIANT getItem(IDispatch* ooo, LONG iii);