MFC:如何捕获Web浏览器控件中的链接单击事件?

MFC:如何捕获Web浏览器控件中的链接单击事件?

问题描述:

我有一个带有Web控件的MFC应用程序.单击可单击的链接时,它将使用IE(而不是默认浏览器)打开. 问题:

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

  1. 有没有办法强制使用默认浏览器打开它?
  2. 如果没有,如何捕获链接点击事件,以便以后可以操纵点击事件?

谢谢...

您可以使用"HRESULT STDMETHODCALLTYPE Invoke"捕获单击事件,有关更多详细信息,请参见MSDN. 这是一个很好的示例,展示了如何使用默认浏览器在同一窗口中打开URL,或打开新窗口> http://www.codeproject.com/KB/IP/urlnewwindow.aspx

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