IRawElementProviderAdviseEvents.AdviseEventRemoved Method (Int32, Int32[])


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

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

void AdviseEventRemoved(
	int eventId,
	int[] properties


Type: System.Int32

The identifier of the event being removed

Type: System.Int32[]

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

This method enables the UI Automation provider to reduce overhead by not raising events that are no longer 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 removes property changes from a list of those that have been subscribed to.

void IRawElementProviderAdviseEvents.AdviseEventRemoved(int eventId,
                                                        int[] properties)
    if (eventId == AutomationElement.AutomationPropertyChangedEvent.Id)
        Console.WriteLine("Property changes no longer subscribed to:");
        foreach (int i in properties)
            AutomationProperty property = AutomationProperty.LookupById(i);
            // Remove from an ArrayList.

.NET Framework
Available since 3.0
Return to top