Версия для печати темы
Нажмите сюда для просмотра этой темы в оригинальном формате
Форум программистов > C++ Builder > Нажать на кнопку "отправить" на сайте мтс


Автор: Kasiro 31.7.2011, 10:21
Всем привет. Немогу понять как программно отправить смс через TWebBrowser. Заполняю поля, ввожу капчу, вызываю submit - не отправляет)

http://www.mts.ru/messaging1/sendsms/

вот эта самая страница

Автор: Kasiro 1.8.2011, 14:27
вопрос уже не актуален

может кто нибудь подсказать как из twebbrowser извлечь идентификатор сессии?

Автор: Kasiro 4.8.2011, 12:46
Если кому нужно будет:

Нажатие кнопки (любой). В качестве параметра передаём название кнопки (у мтс это ctl00$ctl00$ctl00$ctl03$ctl00$ctl05$ctl01$ctl01$ctl00$SmsSendingControl$btnSend)

Код

void TMainForm::BtnClick(UnicodeString Name){

wchar_t *s;
if(WB->Document )
   {
        TComInterface<IHTMLDocument2> pDocument;
        WB->Document->QueryInterface(IID_IHTMLDocument2, (LPVOID*)&pDocument);

        if( pDocument )
        {

            TComInterface<IHTMLElementCollection> pCollectionBtn2;
            pDocument->get_all(&pCollectionBtn2);

            if (pCollectionBtn2) {
              long l;
             pCollectionBtn2->get_length(&l);

             for(int i = 0; i < l; i++)
               {
                TComInterface<IDispatch> pDisp;
                pCollectionBtn2->item(TVariant(i),TVariant(0), &pDisp);

                if( pDisp )
                 {
                    TComInterface<IHTMLElement> pElement;
                    pDisp->QueryInterface(IID_IHTMLElement, (LPVOID*)&pElement);

                   if( pElement )             
                    {

                    TVariant S;
                    pElement->getAttribute(L"name", 0, &S);
                    System::Word G=VarType(S);
                    if (G==8) {
                    if (Pos(Name, S)) {
                    pElement->click();
                    }
                    }

                    }

                    }
                 }
               }
            }
        }
}
//---------------------------------------------------------------------------------

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)