WebBrowser stops navigating - Why?

M

Mitch

I ahve a windowsform app with an embedded web browser. I let VS create a
wrapper called AxWebBrowser. The "BeforeNavigate2" event handler
fires as expected, unitl I also add a handler to the "onclick"
event that is part of the mshtml.HTMLDocumentEvent2 object. In addition
when I add the "onclick" event handler, the browser looses all
ability to navigate. i.e. clicking a link does nothing, no events
raised, no navigating to the link url.

If tried different return values in the "onclick" event handler,
but the results are always the same. I've seen older posts with
this same problem, but no one seems to have figured it out.

Any ideas? Thanks.

Mitch

Here's the code where I wire up the event handlers:

this.axWebBrowser1.BeforeNavigate2 += new
AxSHDocVw.DWebBrowserEvents2_BeforeNavigate2EventHandler
(this.axWebBrowser1_BeforeNavigate2);

//This goes on the Download complete handler:

mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
mshtml.HTMLDocumentEvents2_Event iEvent =
(mshtml.HTMLDocumentEvents2_Event) doc;
iEvent.onclick += new
mshtml.HTMLDocumentEvents2_onclickEventHandler(iEvent_onclick);
 
S

Shakir Hussain

Mitch,

If you add onclick event handler, the browser will go for toss for sure.

You have to implement IDocHostUIHandler and IHTMLEditDesigner to handle the
events. Search in MSDN for this.

Shak.
 
M

Mitch

I saw that, but it seems like I already have access to the events I need.
It's just that one event kills another. Also the IDocHostUIHandler
has 17 methods and I can't find a good example of what each method should
do.

Is it a bug that one event handler kills the other? or is there some
explanation?

Mitch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top