470,815 Members | 1,272 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,815 developers. It's quick & easy.

mouseover event in axWebbrowser kills navigation functions

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(docEve nts_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;
}
Nov 16 '05 #1
2 5030

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);

--
Shak
(Houston)
"Mitch" <xx***@avantium.com> wrote in message
news:uV**************@TK2MSFTNGP12.phx.gbl...
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(docEve nts_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;
}

Nov 16 '05 #2
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

"Shakir Hussain" <sh**@fakedomain.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...

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);

--
Shak
(Houston)
"Mitch" <xx***@avantium.com> wrote in message
news:uV**************@TK2MSFTNGP12.phx.gbl...
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(docEve nts_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;
}


Nov 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Colin Steadman | last post: by
9 posts views Thread by Kim | last post: by
2 posts views Thread by Casey | last post: by
3 posts views Thread by Annette Acquaire | last post: by
1 post views Thread by Christian Sengstock | last post: by
reply views Thread by mihailmihai484 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.