Article View: borland.public.cppbuilder.internet.web
Article #469Re: Help with TCppWebBrowser - Find and click a button
From: mike
Date: Sun, 07 Jan 2007 14:40
Date: Sun, 07 Jan 2007 14:40
83 lines
3944 bytes
3944 bytes
Hans,
Well I am clearly not understanding why the button is not found. I am using
the following code and I thought the button would have been found as I am
taking into account the 2 frames, I think.
Can you point out what I am not understanding or where I have gone wrong.
Thanks very much
Mike
if( CppWebBrowser1->Document )
{
TComInterface<IHTMLDocument2> Doc;
CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument2,(LPVOID*)&Doc);
if( Doc )
{
TComInterface<IHTMLFramesCollection2> Frames;
Doc->get_frames(&Frames);
if( Frames )
{
long cnt = 0;
Frames->get_length(&cnt);
for(long l = 0; l < cnt; ++l)
{
// TVariant IndexOrName = WideString("frame name");
// or:
TVariant IndexOrName = l;
TVariant Frame;
Frames->item(&IndexOrName, &Frame);
if( (V_VT(&Frame) == VT_DISPATCH) && (V_DISPATCH(&Frame)
!= NULL) )
{
TComInterface<IHTMLWindow2> Window;
V_DISPATCH(&Frame)->QueryInterface(IID_IHTMLWindow2,(LPVOID*)&Window);
if( Window )
{
TComInterface<IHTMLDocument2> FrameDoc;
Window->get_document(&FrameDoc);
if( FrameDoc )
{
// use FrameDoc as needed ...
TComInterface<IHTMLElementCollection> All;
FrameDoc->get_all(&All);
if( All )
{
TComInterface<IDispatch> Disp;
All->item(TVariant(WideString("secure_exit")),TVariant(0),
&Disp);
if( Disp )
{
TComInterface<IHTMLElement> Element;
Disp->QueryInterface(IID_IHTMLElement,(LPVOID*)&Element);
if( Element )
{
ShowMessage (
"Element->click();");
Element->click();
break ;
}
}
}
}
}
}
}
}
}
}
Technical Details
Message-ID:
<45a10643$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!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>Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,6ed59181280548e1 X-Google-Attributes: gidfeeec,public X-Google-Language: ENGLISH,ASCII-7-bit From: "mike" <mfbrowne@earthlink.nnet> 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> Subject: Re: Help with TCppWebBrowser - Find and click a button Date: Sun, 7 Jan 2007 09:40:24 -0500 Lines: 87 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 NNTP-Posting-Host: 72.185.80.204 Message-ID: <45a10643$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1168180803 72.185.80.204 (7 Jan 2007 06:40:03 -0800) Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail