Click to See Complete Forum and Search --> : IE4/5 & DocumentComplete event


W D'Anjos
April 20th, 1999, 09:34 AM
Hi,

I wrote an event sink to trap Internet Explorer's DocumentComplete events. It is working fine but some URLs doesn't fire this event (mail.yahoo.com, for example), does any body now why? Is there a work around?

A page that is reloaded (user presses the 'refresh' button) doesn't fire the DocumentComplete event also. But my application must catch reloads too, any idea on how it can be done?

This behavior occurs on IE4 and IE5.

Any information is greatly appreciated.

Thanks in advance,

W D'Anjos

W D'Anjos
April 20th, 1999, 06:36 PM
> I wrote an event sink to catch Ineternet Explorer's DocumentComplete events.
> It is working fine but some URLs doesn't fire this event (mail.yahoo.com, for
> example), does any body now why? Is there a work around?

I found that this problem happens whenever the URL is redirected. I also noted that the DownloadBegin/DownloadComplete events are not matching when the URL is redirected, for example when accessing <mail.yahoo.com> IE fires 01 DownloadBegin and 02 DownloadComplete events... but the documentation says that these events should match... pretty weird! I belive this is a bug in IE4/5... any insights?

W D'Anjos

PS: My <Invoke> code follows
----------------------------------------

STDMETHODIMP CCommBand::Invoke(
DISPID dispIdMember,
REFIID riid,
LCID lcid,
WORD wFlags,
DISPPARAMS *pDispParams,
VARIANT *pVarResult,
EXCEPINFO *pExcepInfo,
UINT *puArgErr)
{
if (!pDispParams)
{
return E_INVALIDARG;
}

switch(dispIdMember)
{
case DISPID_BEFORENAVIGATE2:
::MessageBox(NULL, "<BeginNavigate2>", "Invoke", MB_OK);
break;
case DISPID_DOWNLOADBEGIN:
::MessageBox(NULL, "<DownloadBegin>", "Invoke", MB_OK);
break;
case DISPID_DOWNLOADCOMPLETE:
::MessageBox(NULL, "<DownloadComplete>", "Invoke", MB_OK);
break;
case DISPID_DOCUMENTCOMPLETE:
if (pDispParams->cArgs >= 2 &&
pDispParams->rgvarg[0].vt == (VT_BYREF|VT_VARIANT))
{
VARIANT vtURL;

VariantInit(&vtURL);
if (SUCCEEDED(VariantChangeTypeEx(&vtURL,
&(pDispParams->rgvarg[0]),
lcid,
0,
VT_BSTR)))
{
char str[100];
if (WideCharToMultiByte(CP_ACP,
0,
vtURL.bstrVal,
-1,
str,
ARRAYSIZE(str),
NULL,
NULL))
{
::MessageBox(NULL, str, "Invoke", MB_OK);
}
}
}
break;
default:;
}

pVarResult=NULL;
pExcepInfo=NULL;
puArgErr=NULL;

return S_OK;
}