能帮我把这20多行关于SafeArray的C代码翻译成Delphi吗? ( 积分: 200 )

  • 主题发起人 主题发起人 cemi
  • 开始时间 开始时间
C

cemi

Unregistered / Unconfirmed
GUEST, unregistred user!
CComVariant vBodyArr;
long i = -1;
SAFEARRAY* psaBody = V_ARRAY(&vBodyArr);
LPDISPATCH* pBodyDispArray = NULL;
long nBodyHighIndex = -1;
long nBodyCount = -1;

hr = SafeArrayAccessData(psaBody, (void **) &pBodyDispArray);
ASSERT(NULL != pBodyDispArray);
hr = SafeArrayGetUBound(psaBody, 1, &nBodyHighIndex);

nBodyCount = nBodyHighIndex + 1;
for (i = 0; i < nBodyCount; i++)
{
CComQIPtr <IBody2> pBody;
pBody = pBodyDispArray;
ASSERT(pBody);
hr = pBody->Select(VARIANT_TRUE, 0, &bRet);
ASSERT(bRet);
pBody.Release();
}

// Unaccess & destroy the component SafeArray
hr = SafeArrayUnaccessData(psaBody);
hr = SafeArrayDestroy(psaBody);
 
难,看不懂,类似variant和olevariant.

varArrayCareate
varArrayHighBound
之类的.如果是,看 以下上面函数的帮助,查看以下unit单元.
 
后退
顶部