Too many callbacks after installing multiple event handlers RRS feed

  • Question

    CoCreateInstance(CLSID_CUIAutomation, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pAutomation));

    MyEventHandler* handler1 = new MyEventHandler(); MyEventHandler* handler2 = new MyEventHandler();
    AnotherEventHandler* handler3 = new AnotherEventHandler(); pAutomation->AddStructureChangedEventHandler(element, TreeScope_Element, NULL, handler1 ); pAutomation->AddStructureChangedEventHandler(differentelement, TreeScope_Element, NULL, handler2 );
    pAutomation->AddStructureChangedEventHandler(anotherelement, TreeScope_Element, NULL, handler3 );

    Any events in any of the automation elements will trigger all event handlers callback functions

    How do we avoid this?

    Friday, February 8, 2013 10:18 PM