| Newbie | | Join Date: Sep 2007 Location: 中国民主社会主义党Democratic Socialist Party C
Posts: 2
| |
| re: returning arrays from COM to JScript Quote:
What's the question?
http://groups.google.com/group/microsoft.public.scripting.jscript/browse_thread/thread/0e10ec0571c9ca48/2d160e9d46d49c3e
JScript takes array[0][1] as array.0.1 -
-
-
STDMETHODIMP CUfmArray::XLocalClass::GetDispID(
-
BSTR bstrName, DWORD grfdex, DISPID *pid)
-
{
-
METHOD_PROLOGUE(CUfmArray, LocalClass)
-
-
CString strValue;
-
if(pThis->m_psaAry.Lookup(CString(bstrName),strValue))
-
{
-
*pid =pThis->m_pidAry->GetCount()+0x1000;
-
pThis->m_pidAry->AddTail(strValue);
-
-
return S_OK;
-
}
-
return pThis->m_JuggleAry->GetDispID( bstrName, grfdex, pid);
-
}
-
-
STDMETHODIMP CUfmArray::XLocalClass::InvokeEx(
-
DISPID id, LCID lcid, WORD wFlags,
-
DISPPARAMS *pdp, VARIANT *pvarRes, EXCEPINFO *pei,
-
IServiceProvider *pspCaller)
-
{
-
METHOD_PROLOGUE(CUfmArray, LocalClass)
-
-
CString strValue;
-
if(strValue = pThis->m_pidAry->GetAt(pThis->m_pidAry->FindIndex(id-0x1000)))
-
{
-
// Validate that they passed in a valid variant for results
-
// and have no parameters assigned to the "Get"
-
if( pvarRes != NULL &&
-
(pdp == NULL || pdp->cArgs == 0) )
-
{
-
// Do the "Get" with the specified ID
-
VariantClear(pvarRes);
-
pvarRes->vt =VT_BSTR;
-
pvarRes->bstrVal = strValue.AllocSysString();
-
}
-
else
-
{
-
// They passed in bogus stuff
-
return E_INVALIDARG;
-
}
-
return S_OK;
-
}
-
-
-
HRESULT hr = pThis->m_JuggleAry->InvokeEx( id, lcid, wFlags,
-
pdp, pvarRes, pei,
-
pspCaller);
-
-
if(hr ==E_POINTER)
-
{
-
IUfmArray* pSry =(IUfmArray*)pThis->GetInterface(&IID_IUfmArray);
-
-
-
UINT nErrArg = 0;
-
-
hr =pSry->Invoke( id, IID_NULL, lcid, wFlags,
-
pdp, pvarRes, pei,
-
&nErrArg);
-
}
-
return hr;
-
}
-
-
|