How to : Hook IE document message...
-
Hi. I'm Soohyun Bae. Now I'd like to hook some messages invoked by IE document, for example, mousemove, mouse click, key down... Now, I could receive these messages by connecting my class derived from IDispatch to IE document. CImpDispatch* m_pEvents; m_pEvents = new CImpDispatch((IOleInPlaceFrame *)this); hr = pCPC->FindConnectionPoint( DIID_HTMLDocumentEvents, &m_pConnectionPoint ); hr = m_pConnectionPoint->Advise(m_pEvents, m_dwConnectCookie ); ... and CImpDispatch... STDMETHODIMP CImpIDispatch::Invoke( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarResult, EXCEPINFO* pExcepInfo, UINT* puArgErr) { IHTMLEventObj *pEvtObj = NULL; long x; HRESULT hr; if (dispIdMember == DISPID_HTMLDOCUMENTEVENTS_ONKEYDOWN ) { hr = m_pWindow->get_event(&pEvtObj); if (hr == S_OK) { pEvtObj->get_keyCode(&x); // A key hook if (x==65) { Trace("_HOOK: A key pressed"); x=0; // Point 1 hr = pEvtObj->put_keyCode(x); // Point 2 if (hr==S_OK) { pEvtObj->get_keyCode(&x); } } } } return S_OK; } I could take reference code in www.microsoft.com/Mind/1297/hookIE.htm (really good...) ----------------------------------------------------------- My Point is : I hope to prevent resending specified message to IE. I have thought that two points 1 and 2 could make so. But, ... couldn't... How can I prevent resending ?