Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ConnectionPoint::Advise fails

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I am a pretty new developer. I have an MFC web browser app, and I want a good way to catch mouseover and mouseout events from all links on a given page. After a page loads, I get a pointer to the document and attempt to set up a sink using a class derived from IDispatch, called CEvtSink. I am using the HTMLLinkElementEvents interface. When I call Advise, the function doesn't just return unsuccessful, it CRASHES my application! What is this all about? Is there a better way to catch link mouseover events? Thanks in advance.
 
It sounds like an access violation: one of your interface pointers might be invalid. Try running the component in debug mode and see if you can pin down where in the code the error is occurring. I had a ton of problems with connection points a while back and all the problems turned out to be something I had done.

To run the component in debug mode, start debug. At some point shortly thereafter, you get a prompt asking you which executable you want to run the component with. You should set it to Internet Explorer. When IE then starts up, you have to then navigate to the HTML page you are using to run your component. When the browser then crashes you will be able to see something in visual studio though it might not be helpful if the exception is occurring in IE.

Also, beware that in debug mode Visual Studio will sometimes allow COM violations to occur without crashing immediately but in ReleaseMinSize mode the browser will crash more readily. In other words, make sure you test both debug and non-debug builds of the component. If you only test in debug version, you might get the illusion that everything is hunky-dory when it's not.

Hope this helps a little.
--Will Duty
wduty@radicalfringe.com

 
Also, you could just catch the events from javascript and forward them as plain method calls to your component since javascript event handling is probably easier than fiddling around with connection point sinks. Perhaps you have security reasons for doing it in the component?
--Will Duty
wduty@radicalfringe.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top