Solved

Capturing refresh event on IE

Posted on 2001-08-20
7
1,752 Views
Last Modified: 2013-12-03
Am trying to capture the Refresh event of a html page.
I am using an activeX component that implement few inerfaces and sink dwebbrowserevents as well but didn't find a way I could capture the 'refresh' event (the browser won't send a 'BeforeNavigate' nor 'Document/DownloadComplete').
The best I could come to (so far) is capturing the onbeforeunload (of the IHTMLWindow2 obj) of the document and distinguish between a case where the browser had a 'BeforeNavigate' event just  before the onbeforeunload event initiated. Still it's kinda screwy way...
Looking 4 help!
0
Comment
Question by:GuyK
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6405576
have you tried dwebbrowserevents2 ?
0
 

Author Comment

by:GuyK
ID: 6405597
Am trying to capture the Refresh event of a html page.
I am using an activeX component that implement few inerfaces and sink DWEBBROWSEREVENTS2 as well but
didn't find a way I could capture the 'refresh' event (the browser won't send a 'BeforeNavigate/2' nor
'Document/DownloadComplete/2').
The best I could come to (so far) is capturing the onbeforeunload (of the IHTMLWindow2 obj) of the document
and distinguish between a case where the browser had a 'BeforeNavigate' event just  before the onbeforeunload
event initiated. Still it's kinda screwy way...
Looking 4 help!

(see corrections...)
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6406008
strange that you are not seeing a BeforeNavigateEvent - I have not trouble seeing that event at all

How have you set up the receiving of events? code sample could be useful here
0
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

by:GuyK
ID: 6406075
Hi Shaun,
Strange your browser fires a 'BeforeNavigate' event because mine doesn't.
Let me add more details:
I'm using IE5 on OS Windows 2000.

If it helps, here's the code:

******* CWBMyHost.h **********
class CWBMyHost:
public.......
....
....
public IDispEventImpl<0, CWBMyHost, &__uuidof(SHDocVw::DWebBrowserEvents2), &LIBID_SHDocVw, 1, 0>,
public...

.
.
.
.
BEGIN_SINK_MAP(CWBMyHost)
   SINK_ENTRY_EX(0, (__uuidof(SHDocVw::DWebBrowserEvents2)), DISPID_DOCUMENTCOMPLETE, NavigateComplete)
   SINK_ENTRY_EX(0, (__uuidof(SHDocVw::DWebBrowserEvents2)), DISPID_BEFORENAVIGATE2, BeforeNavigate)
END_SINK_MAP()
.
.
.
.
STDMETHOD(NavigateComplete)(IDispatch* pDisp, VARIANT* URL);
STDMETHOD(BeforeNavigate)(IDispatch *pDisp,
               VARIANT *URL,
               VARIANT *Flags,
               VARIANT *TargetFrameName,
               VARIANT *PostData,
               VARIANT *Headers,
               VARIANT_BOOL *Cancel);
.
.
.
.
};

******* CWBMyHost.cpp **********

.
.
.
STDMETHODIMP CWBMyHost::NavigateComplete(IDispatch* pDisp, VARIANT* URL)
{
...
}

STDMETHODIMP CWBMyHost::BeforeNavigate(IDispatch *pDisp,
    VARIANT *URL,
    VARIANT *Flags,
    VARIANT *TargetFrameName,
    VARIANT *PostData,
    VARIANT *Headers,
    VARIANT_BOOL *Cancel
)
{
...
}

.
.
.

But I don't think the code is problematic (in this manner) because I do get these events when I navigate (through links or through the back/forward buttons)


0
 
LVL 9

Accepted Solution

by:
ShaunWilde earned 119 total points
ID: 6406310
oops you right - my refresh button - was an actual wrapped Navigate() with the last URL (strange what you do late at night and can't remeber why) - you do get a downloadbegin/complete events which you can use - eg if you get a download complete without a BeforeNavigate then it must be a refresh
0
 

Author Comment

by:GuyK
ID: 6409026
Sometimes the answer is right under your nose but you need someone (usually from the outside) to show it to you.
This is just what you did. Thanks
p.s.
I know it looks obvious but still - thanks a lot
0
 
LVL 9

Expert Comment

by:ShaunWilde
ID: 6409039
glad to help :)
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After several hours of googling I could not gather any information on this topic. There are several ways of controlling the USB port connected to any storage device. The best example of that is by changing the registry value of "HKEY_LOCAL_MACHINE\S…
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question