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 27 28 29 30 31 32 33 34 35 36 37 38 39
|
{
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)
{
if (ElementType == "submit")
{
OleVariant ElementValue;
if (DocElement->getAttribute(WideString("value"), 0, ElementValue) == NO_ERROR)
{
if (MessageDlg("Click sur " + ElementValue + " ?", mtConfirmation, TMsgDlgButtons() << mbYes << mbNo, 0) == mrYes)
{
DocElement->click();
}
}
}
}
DocElement->Release();
}
}
}
}
} |
Partager