IRawElementProviderAdviseEvents.AdviseEventAdded Method (Int32, Int32[])


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Notifies the UI Automation provider when a UI Automation client begins listening for a specific event, including a property-changed event.

Namespace:   System.Windows.Automation.Provider
Assembly:  UIAutomationProvider (in UIAutomationProvider.dll)

void AdviseEventAdded(
	int eventId,
	int[] properties


Type: System.Int32

The identifier of the event being added.

Type: System.Int32[]

The identifiers of the properties being added, or null if the event listener being added is not listening for property events.

This method enables the provider to reduce overhead by raising only events that are being listened for.

The eventId can be compared with the Id of an AutomationEvent such as WindowClosedEvent. You can also obtain the AutomationEvent by using LookupById.

The following example adds to a list of property changes that have been subscribed to.

void IRawElementProviderAdviseEvents.AdviseEventAdded(int eventId, 
                                                      int[] properties)
    if (eventId == AutomationElement.AutomationPropertyChangedEvent.Id)
        foreach (int i in properties)
            AutomationProperty property = AutomationProperty.LookupById(i);
            // Add to an ArrayList.

.NET Framework
Available since 3.0
Return to top