Share via


IUIAutomation::AddPropertyChangedEventHandler Method

Registers a method that handles property-changed events.

Syntax

HRESULT AddPropertyChangedEventHandler(      
    IUIAutomationElement *element,
    TreeScope scope,
    IUIAutomationCacheRequest *cacheRequest,
    IUIAutomationPropertyChangedEventHandler *handler,
    SAFEARRAY propertyArray[PROPERTYID]
);

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 children.
  • cacheRequest
    [in] The address of the IUIAutomationCacheRequest interface of a cache request, or NULL if no caching is wanted.
  • handler
    [in] The IUIAutomationPropertyChangedEventHandler interface of the object that handles the event.
  • propertyArray
    [in] A SAFEARRAY containing the Microsoft UI Automation properties of interest. For a list of property IDs, see Property Identifiers.

Return Value

Returns S_OK if successful, or an error value otherwise.

Remarks

The UI item specified by element might not support the properties specified by the propertyArray parameter.

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::AddPropertyChangedEventHandlerNativeArray, IUIAutomation::RemovePropertyChangedEventHandler, IUIAutomation::RemoveAllEventHandlers, Caching UI Automation Properties and Control Patterns, UI Automation Events for Clients, Working with Safe Arrays