VARIANT varParams; //this is a JScript array passed in
//if not VT_DISPATCH then return. if(varParams.vt!=VT_DISPATCH) return E_INVALIDARG;
//get the IDispatchEx of varParams CComPtr<IDispatchEx> pDispEx; HRESULT hr=varParams.pdispVal->QueryInterface(IID_IDispatchEx,(void**)&pDispEx); if(FAILED(hr)) return E_INVALIDARG;
//Enum all the properties of the jscript array. DISPID dispid;
//get the DISPID of the first item. hr = pDispEx->GetNextDispID(fdexEnumAll, DISPID_STARTENUM, &dispid); while (hr == NOERROR) { //get the item name CComBSTR bstrName; hr = pDispEx->GetMemberName(dispid, &bstrName); if (FAILED(hr)) return E_FAIL; //get the item value CComVariant vValue; DISPPARAMS dispparamsNoArgs = {NULL, NULL, 0, 0}; hr = pDispEx->InvokeEx(dispid, LOCALE_USER_DEFAULT, DISPATCH_PROPERTYGET, &dispparamsNoArgs, &vValue, NULL, NULL); if(FAILED(hr)) return E_FAIL;
//get the DISPID of the next item. hr = pDispEx->GetNextDispID(fdexEnumAll, dispid, &dispid); }
|