1

I am trying to capture messages sent from CWebBrowser2 Object.

m_WebBrowser.Create(_T(""), _T(""), WS_VISIBLE, rect, this, 1, NULL);

m_WebBrowser.Navigate(_T("www.test.com"), NULL, NULL, NULL, NULL);

m_WebBrowser.SetDlgCtrlID(1000);

My EVENTSINK_MAP looks like this :

BEGIN_EVENTSINK_MAP(CWebBrowserDlg, CDialog)
ON_EVENT(CWebBrowserDlg, 1000, DISPID_COMMANDSTATECHANGE,
    CWebBrowserDlg::Test, VTS_NONE)
END_EVENTSINK_MAP()

And the fuction that must be called :

    void CWebBrowserDlg::Test(long Command, BOOL Enable)
{
    int j = 0; // so i can get a breakpoint 
}

However i can never enter Test() when the browser navigates to a page, clicked by user.

Alexander Demerdzhiev
  • 1,034
  • 2
  • 14
  • 29
  • Found [this](http://coldui.googlecode.com/svn/trunk/ColdUI/archive/source/OXWebView.cpp). It is a source for some dialog box. Find on the page the SetDlgCtrlID() and you will see the programmer's comment about the sneaky SetDlgCtrlID(). I do not have any formal MSDN reference for that MFC feature – cha May 28 '15 at 04:50
  • Thank you for your comment.If i succeed with capturing these events i will post the solution of this problem as an answer. – Alexander Demerdzhiev May 28 '15 at 13:30

0 Answers0