Board index » cppbuilder » BHO OnRefresh Event

BHO OnRefresh Event


2004-07-23 01:56:40 AM
cppbuilder89
Greetings,
I need an OnRefresh event for IWebBrowser2.
Currently I am using the DISPID_DOWNLOADCOMPLETE event if the
DISPID_DOWNLOADBEGIN was not preceded by DISPID_BEFORENAVIGATE2.
It works fine for most of the sites, but in some cases like
search.yahoo.com, if i have
have heavy traffic on my machine, the document seems to autorefresh, and
enters an
infinite loop.
As i need to work on the DISPID_DOCUMENTCOMPLETE, i stop the browser and
issue a navigate command so it fires the DOCUMENTCOMPLETE.
Any suggestions ?
Here is a sample of my code.
case DISPID_BEFORENAVIGATE2 :
{
URL = pDispParams->rgvarg[5].pvarVal->bstrVal;
bf2 = true;
}
break;
case DISPID_DOWNLOADBEGIN :
{
if ((((URL.Pos("www.google.") == 1) && (URL.Pos("search?") != 0))
||
((URL.Pos("search.yahoo.") == 1) && (URL.Pos("search?") != 0))))
{
try
{
if (bf2 == false)
{
WebBrowser->Stop();
WebBrowser->Navigate(WideString(URL).c_bstr(),NULL,NULL,NULL,NULL);
}
}
catch(...)
{
}
}
}
break;
case DISPID_DOCUMENTCOMPLETE :
{
bf2 = false;
.....
}
 
 

Re:BHO OnRefresh Event

"Hugo Dias" < XXXX@XXXXX.COM >wrote in message
Quote
I need an OnRefresh event for IWebBrowser2.
What exactly are you trying to accomplish in general? Please provide more
details.
Gambit
 

Re:BHO OnRefresh Event

I need to format the search results before they're are displayed.
Everything is OK except when the page is Refreshed
If Refresh is used, the formatting is lost.
Is there any way of overriding the Refresh and Refresh2 methods of the
browser object ?
 

{smallsort}