void __fastcall TForm1::Button1Click(TObject *Sender)//вставить номер телефона
{
String Name = "txtAddr"; //
String Data = Edit1->Text;
TComInterface<IHTMLDocument2> pDoc;
TComInterface<IHTMLElementCollection> pColl;
TComInterface<IDispatch> pTmpDisp;
TComInterface<IHTMLInputElement> pElement;
TComInterface<IDispatch> pDisp;
if ( SUCCEEDED (WB->Document->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pDoc))) {
if ( SUCCEEDED (pDoc->get_all(&pColl))) {
if ( SUCCEEDED (pColl->item(TVariant(WideString(Name)), TVariant(0), &pDisp))) {
pElement = pDisp;
pElement->put_value(WideString(Data));
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button2Click(TObject *Sender)//кнопка отправить смс
{
String Name="Submit2";
if( WB->Document ) {
TComInterface<IHTMLDocument2> pDocument;
WB->Document->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pDocument);
if( pDocument ) {
TComInterface<IHTMLElementCollection> pCollection;
pDocument->get_all(&pCollection);
if( pCollection ) {
TComInterface<IDispatch> pDisp;
pCollection->item(TVariant(WideString(Name)), TVariant(0), &pDisp);
if( pDisp ) {
TComInterface<IHTMLElement> pElement;
pDisp->QueryInterface(IID_IHTMLElement, (LPVOID*)&pElement);
if( pElement ) {
pElement->click();
}
}
}
}
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button3Click(TObject *Sender) //ввод капчи
{
String Name = "code"; //
String Data = Edit1->Text;
TComInterface<IHTMLDocument2> pDoc;
TComInterface<IHTMLElementCollection> pColl;
TComInterface<IDispatch> pTmpDisp;
TComInterface<IHTMLInputElement> pElement;
TComInterface<IDispatch> pDisp;
if ( SUCCEEDED (WB->Document->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pDoc))) {
if ( SUCCEEDED (pDoc->get_all(&pColl))) {
if ( SUCCEEDED (pColl->item(TVariant(WideString(Name)), TVariant(0), &pDisp))) {
pElement = pDisp;
pElement->put_value(WideString(Data));
}
}
}
}