Important:Sinking to HTML element events in IE
Posted on 2006-05-06
TO understand we create a sink to html element events and 'advise' it as follows:
bool Cembrowsersink::ConnectEvents(IHTMLElement* pElem)
IConnectionPointContainer* pCPC = NULL;
IConnectionPoint* pCP = NULL;
IUnknown* pUnk =NULL;
// Check that this is a connectable object.
AtlTrace(_T("\nCheck that this is a connectable object."));
hr = pElem->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPC);
//AtlTrace(_T("Find the connection point."));
hr = pCPC->FindConnectionPoint(DIID_HTMLElementEvents2, &pCP);
//AtlTrace(_T("create the instance of the element sink."));
//AtlTrace(_T("Advise the connection point."));
hr = pCP->Advise(pUnk, &m_dwCookie);
When we run it against the htlml element collection on GOOGLE home page ,we find that there are certain HTML elements aganst which the sink could be hooked (HTML,HEAD,TITLE,,META,,CENTER,,TBODY) while others against which no connection point interface is found like STYLE,SCRIPT,BODY,TABLE,TR,FORM,INPUT.
What's the reason?
If I want to subscribe only to the events of the 'INPUT' html elements ,how do then i do it?