IUIAutomation4::AddChangesEventHandler method

Registers a method that handles change events.

Note  Before implementing an event handler, you should be familiar with the threading issues described in Understanding Threading Issues.
 

Syntax

HRESULT AddChangesEventHandler(
  IUIAutomationElement             *element,
  TreeScope scope                  ,
  int                              *changeTypes,
  int                              changesCount,
  IUIAutomationCacheRequest        *pCacheRequest,
  IUIAutomationChangesEventHandler *handler
);

Parameters

element

Type: IUIAutomationElement*

A pointer to the UI Automation element associated with the event handler.

arg2

Type: TreeScope

The scope of events to be handled; that is, whether they are on the element itself, or on its ancestors and descendants.

changeTypes

Type: int*

A pointer to a list of integers that indicate the change types the event represents.

changesCount

Type: int

The number of changes that occurred in this event.

pCacheRequest

Type: IUIAutomationCacheRequest*

A pointer to a cache request, or NULL if no caching is wanted.

handler

Type: IUIAutomationChangesEventHandler*

A pointer to the object that handles the changes event.

Return Value

Type: HRESULT

If this method succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

A Microsoft 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.

Requirements

   
Minimum supported client Windows 10, version 1607 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header uiautomationclient.h (include UIAutomation.h)

See Also

IUIAutomation4

RemoveAllEventHandlers