Cannot capture events in frames



Hello,

I'm looking for a method to capture mouse events in the frames.
In a single html page, i success getting the mouse position and getting
the word at this position.
But i don't find how to intercept the word in the frame however i
receive events when i move the mouse.


This is a sample of my code :

....

//////////////////////////////////////////
HRESULT hr = S_OK;
CComQIPtr<IOleContainer> pContainer;
CComQIPtr<IHTMLDocument2> pDoc;
CComQIPtr<IHTMLWindow2> pWindow;

hr = m_spWebBrowser2->get_Document(&pDisp);
if (FAILED(hr))
return ;

pContainer = pDisp;
if (!pContainer)
return ;

pDoc = pDisp;
if (!pDoc)
return ;

hr = pDoc->get_parentWindow(&pWindow);
if (FAILED(hr) && !pWindow)
return ;

LPDISPATCH dispFO =
CFunctionObject<CEoBho>::CreateEventFunctionObject(this,
MouseMoveCallback, DISPID_MOUSEMOVE);
VARIANT vIn;
V_VT(&vIn) = VT_DISPATCH;
V_DISPATCH(&vIn) = dispFO;
pDoc->put_onmousemove(vIn);
....

//////////////////////////////////////////

The MouseMoveCallback is called when it's a single html page. it's
works well.
And i can get the world when i move the mouse.

After to manage the frame, I do that:

//////////////////////////////////////////
....

IUnknown *pUnk;

hr = pContainer->EnumObjects(OLECONTF_EMBEDDINGS, &pEnum);
if (FAILED(hr))
return;

ULONG uFetched;

for(UINT i = 0; S_OK == pEnum->Next(1, &pUnk, &uFetched); i ++)
{
TRACE(_T(" Frame\n"));

CComQIPtr<IDispatch> pDispDoc;
CComQIPtr<IWebBrowser2> pBrowser;
CComQIPtr<IHTMLDocument2> pDoc;
CComQIPtr<IHTMLWindow2> pWindow;

pBrowser = pUnk;

hr = pBrowser->get_Document(&pDispDoc);
if (FAILED(hr))
return ;

pDoc = pDispDoc;
if (!pDoc)
return ;

hr = pDoc->get_parentWindow(&pWindow);
if (FAILED(hr) && !pWindow)
return ;

LPDISPATCH dispFO =
CFunctionObject<CEoBho>::CreateEventFunctionObject(this,
MouseMoveCallback2, DISPID_MOUSEMOVE);

VARIANT vIn;
V_VT(&vIn) = VT_DISPATCH;
V_DISPATCH(&vIn) = dispFO;

pDoc->put_onmousemove(vIn);
....
//////////////////////////////////////////

The function MouveMoveCallBack2 is called but this line return always
FALSE !!! : hr = pWindow->get_event(&pEvent);

Can you help me ?

thx

Sebastien

.