views:

242

answers:

2

Hi All,

I have an MFC application that has a webcontrol. When clickable links are clicked, it opens using IE, not the default browser. Questions :

  1. Is there a way to force it to open using the default browser?
  2. If not, how do I capture the Link Click event so I could just manipulate the click event later?

Thanks...

+2  A: 
  1. No, not as far as I know.
  2. Check out the articles on http://ehsanakhgari.org/article/visual-c/webbrowser-goodies . It has a number of articles that show how to set up an event sink using IDocHostUIHandler etc. to handle events like clicking of links. I'm not sure which interface to implement, it's been years since I last did this. Then, you use ShellExecute() with a url as the third parameter to open a url with the default browser.
Roel
A: 

You can capture click events by using "HRESULT STDMETHODCALLTYPE Invoke" see MSDN for more details. And here's a great example that shows how to open your URL using the default browser in the same window, or opening a new window > http://www.codeproject.com/KB/IP/urlnewwindow.aspx

Owen