mouseover event in axWebbrowser kills navigation functions

M

Mitch

I am hosting a web browser ctl in a container that implements the
IDocHostUIHandler interface. I'm using this to control the context menu.This
works fine.

Then, I added a mouseover event to the document in the documentComplete
event handler.

When I add this event handler, I loose all other navigation functions in the
browser! right click, left click, it's all dead. (The mouseover works
though)

Does anyone know ow do I get a mouseover working?

Thanks. (I posted this a few weeks ago, but I'm still having problems. Any
help is appreciated)
Mitch


Below is the code for hooking up the event handler, followed by the event
handler itself (using c# and .Net 1.1):

private void axWebBrowser1_DocumentComplete(object sender,
AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent e)
{
mshtml.HTMLDocument doc = (mshtml.HTMLDocument)axWebBrowser1.Document;
mshtml.HTMLDocumentEvents2_Event docEvents =
(mshtml.HTMLDocumentEvents2_Event) doc;
docEvents.onmouseover+=new
HTMLDocumentEvents2_onmouseoverEventHandler(docEvents_onmouseover);
}

private void docEvents_onmouseover(IHTMLEventObj e)
{
if (e.srcElement.GetType() == typeof(mshtml.HTMLAnchorElementClass))
{
mouseoverTextBox.Text = e.srcElement.GetType().ToString() + " " +
e.srcElement.outerHTML;
}
e.cancelBubble = false;
e.returnValue = false;
}
 
S

Shakir Hussain

You have to implement IHTMLEditDesigner Interface and trap mousemoves in
PreHandleEvent


//get the service provider interface
IServiceProvider htmlServiceProvider =
(IServiceProvider)browser.Document;

object oEditServices;
uint hResult = htmlServiceProvider.QueryService ( ref
Guids.SID_SHTMLEditServices, ref Guids.IID_IHTMLEditServices, out
oEditServices );
mshtml.IHTMLEditServices pEditServices =
(mshtml.IHTMLEditServices)oEditServices;

/// Add this control as a designer of the html document so we can handle
all the events.
pEditServices.AddDesigner (pEditDesigner);
 
M

Mitch

Thanks. I'll give that a try. It seems a bit complex though just to catch am
ouseover event.
Just curious, do you have any insight as to why just catching the events off
the document
doesn't work? why are those event even there?

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