1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| {
Variant OleDocument = CppWebBrowser->OleObject.OlePropertyGet("Document");
if (((IDispatch *)OleDocument) != NULL)
{
Variant DocItemCollection = OleDocument.OlePropertyGet("All");
int ItemCount = DocItemCollection.OlePropertyGet("length");
for (int i = 0; i < ItemCount; i++)
{
Variant DocItem = DocItemCollection.OleFunction("item", i, i);
if (((IDispatch *)DocItem) != NULL)
{
IHTMLElement *DocElement = NULL;
if (((IDispatch *)DocItem)->QueryInterface(Mshtml::IID_IHTMLElement, (void**)&DocElement) == NO_ERROR)
{
OleVariant ElementType;
if (DocElement->getAttribute(WideString("type"), 0, ElementType) == NO_ERROR)
{
... ici tu peux tout énumérer !
}
DocElement->Release();
}
}
}
}
} |
Partager