Article View: borland.public.cppbuilder.internet.web
Article #1036How to click button on Web Page ?
From: Sergey Muschin
Date: Wed, 14 Sep 2005 16:46
Date: Wed, 14 Sep 2005 16:46
46 lines
2109 bytes
2109 bytes
Hi there!
(TCppBrowser control.)
On DocumentComplete event i'm trying to click one of a buttons on a web
page. How do i do that?
Here is my code.
void __fastcall TfrmMain::myBrowserDocumentComplete(TObject *Sender,
LPDISPATCH pDisp, Variant *URL) {
IHTMLDocument2 *HTMLDocument = NULL;
IHTMLInputButtonElement *btn = NULL;
IHTMLElementCollection * el = NULL;
LPDISPATCH pBtn = NULL;
HRESULT hr =
myBrowser->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&HTMLDocument);
if(hr != S_OK)
{ ShowMessage("Could Not Read Response"); return;}
hr = HTMLDocument->get_all(&el);
if (hr != S_OK) {
ShowMessage("HTMLDocument->get_links(&el) FAILED");
}
TVariant vAddress = "Logon", vIndex = 0;
hr = el->item(vAddress, vIndex, &pBtn);
if (hr != S_OK) {
ShowMessage("item(vAddress, vIndex, &pBtn) FAILED");
}
hr = pBtn->QueryInterface(IID_IHTMLInputButtonElement,(LPVOID*)&btn);
if (hr != S_OK) {
ShowMessage("pBtn->QueryInterface FAILED");
}
// now i would like to achive something like btn->Click() to submit the
page
}
Thahk You,
Sergey Muschin
Technical Details
Message-ID:
<43285392$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: feeec,20ab0c6ae146033c,start X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Sergey Muschin" <senimu@hotmail.com> Newsgroups: borland.public.cppbuilder.internet.web Subject: How to click button on Web Page ? Date: Wed, 14 Sep 2005 10:46:19 -0600 Lines: 48 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.3790.1830 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.1830 X-RFC2646: Format=Flowed; Original NNTP-Posting-Host: 204.110.225.254 Message-ID: <43285392$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1126716306 204.110.225.254 (14 Sep 2005 09:45:06 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.spamkiller.net!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail