 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Eduardo Jauch Guest
|
Posted: Fri Feb 02, 2007 12:15 am Post subject: Find and click a link with CppWebBrowser |
|
|
I loaded a page in my program using TCppWebBrowser, that cointais these
lines (among many others):
<a href="javascript: confirmarInformacoesDeVisto();">
<img src="bt_voltar.gif" border="0"></a>
<a href="javascript: confirmarAgendamento();">
<img src="bt_confirmar.gif" border="0"></a>
<a href="javascript: listaSituacaoAgendamento();">
<img src="bt_cancelar.gif" border="0"></a>
How can I execute by program the second line?
I mean, how can I "simulate" by my program the click of the mouse in the
specified link by a user?
I saw a code on another post that execute a "click" on a button (by Remy).
#include <mshtml.h>
#include <utilcls.h>
if( CppWebBrowser1->Document )
{
TComInterface<IHTMLDocument2> Doc;
CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument2,
(LPVOID*)&Doc);
if( Doc )
{
TComInterface<IHTMLElementCollection> All;
Doc->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 )
Element->click();
}
}
}
}
But in this example, the "button" has a name,
<input TYPE="button" NAME="secure_exit" VALUE=" Finished "
onClick="logout();">
And my "links" don't have...
So, how to FIND the right link in the page and how to execute it? |
|
| Back to top |
|
 |
Eduardo Jauch Guest
|
Posted: Sat Feb 03, 2007 2:08 am Post subject: Re: Find and click a link with CppWebBrowser |
|
|
I saw in another post (that I can't remember where), that Javascript can
be put in Navigate like a URL...
So I don't need to find my links, I need only to execute a new Navigate
to that link...
Like:
Browser->Navigate(WideString("javascript: myfunc()"));
But anyway, how to find the links in the page?
Thanks  |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Mar 23, 2007 8:10 am Post subject: Re: Find and click a link with CppWebBrowser |
|
|
"Eduardo Jauch" <eduardo.jauch (AT) gmail (DOT) com> wrote in message
news:45c22e07 (AT) newsgroups (DOT) borland.com...
| Quote: | So, how to FIND the right link in the page and how to execute it?
|
The IHTMLDocument2 interface has an "anchors" collection that you can
access.
Gambit |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|