Article View: borland.public.cppbuilder.internet.web
Article #388Re: Help with TCppWebBrowser - Find and click a button
From: Michael Harris
Date: Mon, 08 Jan 2007 19:20
Date: Mon, 08 Jan 2007 19:20
63 lines
3326 bytes
3326 bytes
If you are interested in seeing what I am talking about.
***** add abutton to your form.
void __fastcall TForm1::Button9Click(TObject *Sender)
{
AnsiString ButtonName = "secure_exit";
if ( ! WBClickButton3 ( FBrowser, ButtonName ) )
ShowMessage ( ButtonName + "\n\nbutton not clicked");
}
******* alter DocClickButton3
if( FrameDoc )
{
// ****** add this line to view the actual source
ShowMessage(GetDocSource ( (_id_IHTMLDocument2) FrameDoc ));
clicked = DocClickButton3 ( FrameDoc, ButtonName );
if ( clicked )
break;
}
*******change the get source method as below.
typedef CComPtr<IHTMLDocument2> _id_IHTMLDocument2; // or tcominterface
typedef CComPtr<IPersistStreamInit> _id_IPersistStreamInit;
AnsiString GetDocSource ( _id_IHTMLDocument2 htm )
{
AnsiString Source = "";
_id_IPersistStreamInit spPsi = NULL; // ocidl.h
if(SUCCEEDED(htm->QueryInterface(IID_IPersistStreamInit,
(LPVOID*)&spPsi)) &&spPsi)
{
IStream *spStream = NULL; // objidl.h
OleCheck(CreateStreamOnHGlobal(NULL, true, &spStream));
if(spStream)
{
__int64 nSize = 0;
STATSTG ss;
LARGE_INTEGER nMove;
nMove.QuadPart = 0;
OleCheck(spPsi->Save(spStream, true));
OleCheck(spStream->Seek(nMove, STREAM_SEEK_SET,
(ULARGE_INTEGER*)&nSize));
OleCheck(spStream->Stat(&ss, STATFLAG_NONAME));
nSize = ss.cbSize.QuadPart;
Source.SetLength(nSize);
OleCheck(spStream->Read((void *)Source.data(), nSize,
(ULONG*)&nSize));
OleCheck(spStream->Release());
}
}
return Source;
}
as Han's Iter functions enumerate the frames, the html source should show.
--
Michael
Technical Details
Message-ID:
<45a299cd@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!panix!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<459ebec4$1@newsgroups.borland.com> <459ec5bf$1@newsgroups.borland.com> <459fbc29$2@newsgroups.borland.com> <45a02189$1@newsgroups.borland.com> <45a02ab5$1@newsgroups.borland.com> <45a0c58e$1@newsgroups.borland.com> <45a0fe8a$1@newsgroups.borland.com> <45a10643$1@newsgroups.borland.com> <45a226d9@newsgroups.borland.com> <45a235ec$1@newsgroups.borland.com> <45a240c7@newsgroups.borland.com> <45a2593e$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,6ed59181280548e1 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit Reply-To: "Michael Harris" <techonos-NO-SPAM-@attbi.com> From: "Michael Harris" <techonos-NO-SPAM-@attbi.com> Newsgroups: borland.public.cppbuilder.internet.web References: <459ebec4$1@newsgroups.borland.com> <459ec5bf$1@newsgroups.borland.com> <459fbc29$2@newsgroups.borland.com> <45a02189$1@newsgroups.borland.com> <45a02ab5$1@newsgroups.borland.com> <45a0c58e$1@newsgroups.borland.com> <45a0fe8a$1@newsgroups.borland.com> <45a10643$1@newsgroups.borland.com> <45a226d9@newsgroups.borland.com> <45a235ec$1@newsgroups.borland.com> <45a240c7@newsgroups.borland.com> <45a2593e$1@newsgroups.borland.com> Subject: Re: Help with TCppWebBrowser - Find and click a button Date: Mon, 8 Jan 2007 13:20:55 -0600 Lines: 69 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 76.187.71.134 Message-ID: <45a299cd@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1168284109 76.187.71.134 (8 Jan 2007 11:21:49 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!news3.google.com!newsfeed2.dallas1.level3.net!news.level3.com!panix!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail