• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 869
  • Last Modified:

Important:Sinking to HTML element events in IE

TO understand we create a sink to html element events and 'advise' it as follows:
bool Cembrowsersink::ConnectEvents(IHTMLElement* pElem)
{
HRESULT hr;
USES_CONVERSION;
IConnectionPointContainer* pCPC = NULL;
IConnectionPoint* pCP = NULL;
DWORD dwCookie;
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);

if (SUCCEEDED(hr))
{
//AtlTrace(_T("Find the connection point."));
hr = pCPC->FindConnectionPoint(DIID_HTMLElementEvents2, &pCP);

if (SUCCEEDED(hr))
{
//AtlTrace(_T("create the instance of the element sink."));
hr=m_selem->QueryInterface(IID_IUnknown,(void**)&pUnk);
if(SUCCEEDED(hr))
{
//AtlTrace(_T("Advise the connection point."));
hr = pCP->Advise(pUnk, &m_dwCookie);

if (SUCCEEDED(hr))
{
AtlTrace(_T("Successfully advised"));
}
}
pCP->Release();
}

pCPC->Release();
}

return false;
}

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?
0
ranadhir
Asked:
ranadhir
1 Solution
 
krbatgeCommented:
I believe you need to find connection points specific to the element type.

e.g.

hr = pCPC->FindConnectionPoint(DIID_HTMLButtonElementEvents2, &pCP); // for buttons

hr = pCPC->FindConnectionPoint(DIID_HTMLInputTextElementEvents2, &pCP); // for input text fields
0
 
ranadhirAuthor Commented:
This does not help either
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now