这段C++怎么转成delphi???(200)

Q

qaz1znz

Unregistered / Unconfirmed
GUEST, unregistred user!
IDispatch* pACDisp
IHTMLAttributeCollection* pAttrColl
IDispatch* pItemDisp
IHTMLDOMAttribute* pItem
LONG lACLength
VARIANT vACIndex
BSTR bstrName
VARIANT vValue
VARIANT_BOOL vbSpecified
pBody->QueryInterface(IID_IHTMLDOMNode, (void**)&pElemDN)
pElemDN->get_attributes(&pACDisp)
pACDisp->QueryInterface(IID_IHTMLAttributeCollection, (void**)&pAttrColl)
pAttrColl->get_length(&lACLength)
cout < <lACLength < <endl
vACIndex.vt = VT_I4
for (int i = 0
i < lACLength
i++) { vACIndex.lVal = i
pAttrColl->item(&vACIndex, &pItemDisp)
pItemDisp->QueryInterface(IID_IHTMLDOMAttribute, (void**)&pItem)
pItem->get_specified(&vbSpecified)
pItem->get_nodeName(&bstrName)
cout < <W2A(bstrName) < <": "
pItem->get_nodeValue(&vValue)
if(vbSpecified==VARIANT_TRUE) { cout < <i
}cout < <endl
pItemDisp->Release()
pItem->Release()
} pElemDN->Release()
pACDisp->Release()
pAttrColl->Release()
这段代码中的vACIndex变量,其中有二个应用 vACIndex.vt = VT_I4
和 vACIndex.lVal = i
不知道怎么办;另:pAttrColl->item(&vACIndex, &pItemDisp);转后为pItemDisp:=pAttrColl.item('vACIndex');这个参数一直出错
 
C

cactus123456

Unregistered / Unconfirmed
GUEST, unregistred user!
这篇文章里有详细的转换语法,很全http://cactusprogram.appspot.com/?p=197003
 
S

szhcracker

Unregistered / Unconfirmed
GUEST, unregistred user!
把 vACIndex 定义成结构体,成员为 vt 和 lVal,均为整形,VT_I4不知道是什么,估计是一个const,你自己看着办。另:pAttrColl->item(&vACIndex, &pItemDisp);这句好像是对地址的操作,D中可以用 @ 取得变量的地址指针
 
Q

qaz1znz

Unregistered / Unconfirmed
GUEST, unregistred user!
多人接受答案了。
 
Top Bottom