To handle those events in ATL, you need to derive a class from IDispEventImpl and add a sink map handling the events you want. Here's some incomplete code that handles mouse over and mouse out events from a browser window embedded as a control:
class MyView : public CWindowImpl<MyView, CAxWindow>,
public IDispEventImpl<1, MyView, &DIID_HTMLElementEvents2, &LIBID_MSHTML, 4, 0>
{
public:
typedef IDispEventImpl<1, MyView, &DIID_HTMLElementEvents2, &LIBID_MSHTML, 4, 0> HTMLElementEventsSink;
BEGIN_SINK_MAP(MyView)
SINK_ENTRY_EX(1, DIID_HTMLElementEvents2, DISPID_HTMLELEMENTEVENTS_ONMOUSEOVER, OnMouseOver)
SINK_ENTRY_EX(1, DIID_HTMLElementEvents2, DISPID_HTMLELEMENTEVENTS_ONMOUSEOUT, OnMouseOut)
END_SINK_MAP()
BEGIN_MSG_MAP_EX(MyView)
MESSAGE_HANDLER(WM_CREATE, OnCreate)
MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
END_MSG_MAP()
private:
You'll need to call HTMLElementEventsSink::DispEventAdvise to tell IE that you want to handle the events, using an appropriate IDispatch pointer to say which objects events you want.