Quantcast
Channel: CodeGuru Forums - Visual C++ Programming
Viewing all articles
Browse latest Browse all 3021

MFC click event don't work between a parent and subclass in a web control

$
0
0
Hi all,

This is my first time here. I'm desperate with a problem using the click event in a web browser control.
I'm a newbie with this c++ stuff, so it's event more difficult to me.

I have a control called CIEBrowser that implements a Web control. Here a message_map:
Code:

IMPLEMENT_DYNCREATE(CIEBrowser, CWnd)

BEGIN_MESSAGE_MAP(CIEBrowser, CWnd)
  ON_COMMAND_RANGE(ID_IEHOME,ID_IESTOP, OnToolBarCmd)
  ON_UPDATE_COMMAND_UI_RANGE(ID_IEHOME,ID_IESTOP, OnUpdateToolBarCmd)
  ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTW, 0, 0xFFFF, OnToolTipNotify)
  ON_NOTIFY_EX_RANGE(TTN_NEEDTEXTA, 0, 0xFFFF, OnToolTipNotify)
END_MESSAGE_MAP()

I want to implement a derived class called CFulltextCtrl.

Code:

IMPLEMENT_DYNCREATE(CFulltextCtrl, CIEBrowser)

BEGIN_MESSAGE_MAP(CFulltextCtrl, CIEBrowser)
    ON_WM_PAINT()
    ON_WM_HELPINFO()
END_MESSAGE_MAP()

I have a dialog with a control using this CFulltextCtrl. I can create and show the html perfectly inside the form. But all links inside this control don't work (scenario 1). If I create a form who have a control of the type CIEBrowser, the EXACTLY same html code works perfectly (scenario 2).

In particulary, I need that when I click in one link, execute a method called OnClick, who performs all that I need, just like in scenario 2.

This is my DISPATCH_MAP in the derived class (CFulltextCtrl):
Code:

BEGIN_DISPATCH_MAP(CFulltextCtrl, CIEBrowser)
    DISP_FUNCTION_ID(CFulltextCtrl,"HTMLELEMENTEVENTS2_ONCLICK", DISPID_HTMLELEMENTEVENTS2_ONCLICK,
    OnClick, VT_EMPTY, VTS_DISPATCH)
    DISP_FUNCTION_ID(CFulltextCtrl,"HTMLELEMENTEVENTS2_ONKEYDOWN", DISPID_HTMLELEMENTEVENTS2_ONKEYDOWN,
    OnKeyDown, VT_EMPTY, VTS_DISPATCH)
    DISP_FUNCTION_ID(CFulltextCtrl,"HTMLELEMENTEVENTS2_ONKEYUP", DISPID_HTMLELEMENTEVENTS2_ONKEYUP,
    OnKeyUp, VT_EMPTY, VTS_DISPATCH)
END_DISPATCH_MAP()

Maybe I don't have the correct form to explain my problem. Please, feel free to ask everything. My future depend on this issue.

Thanks in advance,
Filipe

Viewing all articles
Browse latest Browse all 3021

Trending Articles