Important:Sinking to HTML element events in IE

Posted on 2006-05-06
Last Modified: 2013-11-20
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;
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."));
//AtlTrace(_T("Advise the connection point."));
hr = pCP->Advise(pUnk, &m_dwCookie);

if (SUCCEEDED(hr))
AtlTrace(_T("Successfully advised"));


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?
Question by:ranadhir
    LVL 8

    Accepted Solution

    I believe you need to find connection points specific to the element type.


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

    hr = pCPC->FindConnectionPoint(DIID_HTMLInputTextElementEvents2, &pCP); // for input text fields

    Author Comment

    This does not help either

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    Title # Comments Views Activity
    Strange date stored 22 95
    deburging in oracle form 12 68
    Whole sheet autoscrub still needed 19 41
    Use of condition with 'serial' in ansible 2 22
    Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
    Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
    This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now