Passing JScript string array to Activex
I want to pass anJScript string array tojava script. Can anyone explain me how to do it.
Thanks
I want to pass anJScript string array tojava script. Can anyone explain me how to do it.
Thanks
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. //get the DISPID of the first item.
DISPID dispid;
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);
}