IUIAutomation::AddStructureChangedEventHandler Method

Registers a method that handles structure-changed events.

Syntax

HRESULT AddStructureChangedEventHandler(      
    IUIAutomationElement *element,
    TreeScope scope,
    IUIAutomationCacheRequest *cacheRequest,
    IUIAutomationStructureChangedEventHandler *handler
);

Parameters

  • element
    [in] The address of the IUIAutomationElement interface of the UI Automation element interface with which to associate the event handler.
  • scope
    [in] A value from the TreeScope enumerated type specifying the scope of events to be handled; that is, whether they are on the element itself, or on its ancestors and descendants.
  • cacheRequest
    [in] The address of the IUIAutomationCacheRequest interface of a cache request, or NULL if no caching is wanted.
  • handler
    [in] The address of the IUIAutomationStructureChangedEventHandler interface of the object that handles the structure-changed event.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

A UI Automation client should not use multiple threads to add or remove event handlers. Unexpected behavior can result if one event handler is being added or removed while another is being added or removed in the same client process.

See Also

IUIAutomation::RemoveStructureChangedEventHandler, IUIAutomation::RemoveAllEventHandlers, Caching UI Automation Properties and Control Patterns, UI Automation Events for Clients