Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4090890
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:17:48+00:00 2026-05-20T19:17:48+00:00

Trying to detect if new elements are added or removed from the DOM in

  • 0

Trying to detect if new elements are added or removed from the DOM in MSHTML. Is there such event that will fire?

http://msdn.microsoft.com/en-us/library/aa741877(v=VS.85).aspx

In IE9 there is IDOMMutationEvent::initMutationEvent

http://msdn.microsoft.com/en-us/library/ff975905(v=vs.85).aspx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T19:17:48+00:00Added an answer on May 20, 2026 at 7:17 pm

    Yes, it is possible now in IE8, though it is not part of the MSHTML event structure, but Accessibility.

    Trigger (EVENT_OBJECT_REORDER) is new in IE8 – See http://blogs.msdn.com/b/ie/archive/2008/12/10/new-accessibility-features-in-ie8.aspx?PageIndex=7

    We use it with out BHO, but you could equally hook outside of IE if you choose.

    BHOClass::BHOClass()
    { 
    if( TrackDHTML ) {
    // end event is not used so +1.
    // out of process notifications from accessibility
        m_eHook = ::SetWinEventHook(EVENT_OBJECT_REORDER, EVENT_OBJECT_REORDER+1, 0, MSAALib_WinEventProc, GetCurrentProcessId(), GetCurrentThreadId(), WINEVENT_OUTOFCONTEXT );
    // in process injecting the dll into IE
    //  m_eHook = ::SetWinEventHook(EVENT_OBJECT_REORDER, EVENT_OBJECT_REORDER+1, GetModuleHandle(L"yourhook.dll"), MSAALib_WinEventProc, GetCurrentProcessId(), GetCurrentThreadId(), WINEVENT_INCONTEXT );
    }
    }
    

    And here is how you might look at the accessibility and get the document/browser

    static void CALLBACK MSAALib_WinEventProc(HWINEVENTHOOK hook, 
      DWORD event, 
      HWND hwnd,  // this appears to be the hwnd for the tab and not the specific frame
      LONG idObject,  
      LONG idChild,
      DWORD dwEventThread, // the thread being watched that triggered this call
      DWORD dwmsEventTime)
    {
    if( hwnd != NULL // exclude most mouse move 
        && ( OBJID_WINDOW == idObject ) // || OBJID_CLIENT == idObject )
        )
    { 
        switch( event ) {
            case EVENT_OBJECT_REORDER: break;
            case EVENT_OBJECT_SHOW: break;
            case EVENT_OBJECT_HIDE: break;
            default:
                return;
        }
    
        Log(L"Event START - (%ld) object %ld on window(0x%x)%ld thread (0x%x)%ld\n", event, idObject, hwnd, hwnd, dwEventThread, dwEventThread);
        CComPtr<IAccessible> acc;
        VARIANT varChild;
        AccessibleObjectFromEvent(hwnd, idObject, idChild, &acc, &varChild);
        if( acc ) {
            // step 1 - change from Accessibility interface to html to check we have right type of reorder message
            CComPtr<IServiceProvider> provider;
            HRESULT hr = acc->QueryInterface(IID_IServiceProvider,(LPVOID *)&provider);
            if( SUCCEEDED(hr) && provider ){
                CComPtr<IHTMLElement> spElement;
                hr = provider->QueryService(IID_IHTMLElement,IID_IHTMLElement,(LPVOID *)&spElement);
    
                if( spElement ) {
                    // step 2 - for this doc element get the service provider and then the browser element
                    CComPtr<IServiceProvider> provider2;
                    HRESULT hr = spElement->QueryInterface(IID_IServiceProvider,(LPVOID *)&provider2);
                    CComPtr<IServiceProvider> provider3;
                    if( provider2 )
                        hr = provider2->QueryService(SID_STopLevelBrowser,IID_IServiceProvider,(LPVOID *)&provider3);
                    CComPtr<IWebBrowser2> browser;
                    if( provider3 )
                        hr = provider3->QueryService(SID_SWebBrowserApp,IID_IWebBrowser2,(LPVOID *)&browser);
    
                    if( browser ) {
                        // step 3 - Do stuff 
                    }
                }
            }
        }
        Log(L"Event DONE - (%ld) object %ld on window(0x%x)%ld thread (0x%x)%ld\n", event, idObject, hwnd, hwnd, dwEventThread, dwEventThread);
    }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to detect which web in sharepoint that the user is looking
I'm trying to detect when the onresize event ends in a browser. If I
I'm trying to figure out a way to detect files that are not opened
I'm trying to detect overlap between elements on my canvas. The attempt is to
I'm trying to detect memory leaks by globally overloading new and delete for debug
New to js here. Basically I am trying to detect the existence of a
I'm trying to detect shake events in my application so that I would be
I'm trying to detect the size of the screen I'm starting emacs on, and
I'm trying to figure out how to detect the type of credit card based
I'm trying to determine how I can detect when the user changes the Windows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.