// -------------------------------------------------------------
// UIAutomationClient.idl
//
// UIAutomation Client interface definitions and related types and enums
//
// Copyright (c) Microsoft Corporation. All rights reserved.
// -------------------------------------------------------------

cpp_quote("// -------------------------------------------------------------")
cpp_quote("// UIAutomationClient.H")
cpp_quote("//")
cpp_quote("// UIAutomation Client interface definitions and related types and enums")
cpp_quote("// (Generated from UIAutomationClient.idl)")
cpp_quote("//")
cpp_quote("// Copyright (c) Microsoft Corporation. All rights reserved.")
cpp_quote("// -------------------------------------------------------------")

#define DO_NO_IMPORTS
import "UIAutomationCore.idl";

midl_pragma warning( disable: 2362 )   // This is only expected to go downlevel as far as XP, so a large interface is fine.

// Base enums
enum TreeScope
{
    TreeScope_Element =       0x1,
    TreeScope_Children =      0x2,
    TreeScope_Descendants =   0x4,
    TreeScope_Parent =        0x8,
    TreeScope_Ancestors =     0x10,
    TreeScope_Subtree = TreeScope_Element | TreeScope_Children | TreeScope_Descendants
};

enum PropertyConditionFlags
{
    PropertyConditionFlags_None = 0x00,
    PropertyConditionFlags_IgnoreCase = 0x01,
};

enum AutomationElementMode
{
    AutomationElementMode_None,
    AutomationElementMode_Full
};

typedef void * UIA_HWND;

[
    uuid(944de083-8fb8-45cf-bcb7-c477acb2f897),
    lcid(0),
    version(1.0),
]
library UIAutomationClient
{
    importlib ("stdole2.tlb");

    [dllname("<no entry points>")]
    module UIA_PatternIds
    {
        const long UIA_InvokePatternId             = 10000;
        const long UIA_SelectionPatternId          = 10001;
        const long UIA_ValuePatternId              = 10002;
        const long UIA_RangeValuePatternId         = 10003;
        const long UIA_ScrollPatternId             = 10004;
        const long UIA_ExpandCollapsePatternId     = 10005;
        const long UIA_GridPatternId               = 10006;
        const long UIA_GridItemPatternId           = 10007;
        const long UIA_MultipleViewPatternId       = 10008;
        const long UIA_WindowPatternId             = 10009;
        const long UIA_SelectionItemPatternId      = 10010;
        const long UIA_DockPatternId               = 10011;
        const long UIA_TablePatternId              = 10012;
        const long UIA_TableItemPatternId          = 10013;
        const long UIA_TextPatternId               = 10014;
        const long UIA_TogglePatternId             = 10015;
        const long UIA_TransformPatternId          = 10016;
        const long UIA_ScrollItemPatternId         = 10017;
        const long UIA_LegacyIAccessiblePatternId  = 10018;
        const long UIA_ItemContainerPatternId      = 10019;
        const long UIA_VirtualizedItemPatternId    = 10020;
        const long UIA_SynchronizedInputPatternId  = 10021;
    };

    [dllname("<no entry points>")]
    module UIA_EventIds
    {
        const long UIA_ToolTipOpenedEventId                              = 20000;
        const long UIA_ToolTipClosedEventId                              = 20001;
        const long UIA_StructureChangedEventId                           = 20002;
        const long UIA_MenuOpenedEventId                                 = 20003;
        const long UIA_AutomationPropertyChangedEventId                  = 20004;
        const long UIA_AutomationFocusChangedEventId                     = 20005;
        const long UIA_AsyncContentLoadedEventId                         = 20006;
        const long UIA_MenuClosedEventId                                 = 20007;
        const long UIA_LayoutInvalidatedEventId                          = 20008;
        const long UIA_Invoke_InvokedEventId                             = 20009;
        const long UIA_SelectionItem_ElementAddedToSelectionEventId      = 20010;
        const long UIA_SelectionItem_ElementRemovedFromSelectionEventId  = 20011;
        const long UIA_SelectionItem_ElementSelectedEventId              = 20012;
        const long UIA_Selection_InvalidatedEventId                      = 20013;
        const long UIA_Text_TextSelectionChangedEventId                  = 20014;
        const long UIA_Text_TextChangedEventId                           = 20015;
        const long UIA_Window_WindowOpenedEventId                        = 20016;
        const long UIA_Window_WindowClosedEventId                        = 20017;
        const long UIA_MenuModeStartEventId                              = 20018;
        const long UIA_MenuModeEndEventId                                = 20019;
        const long UIA_InputReachedTargetEventId                         = 20020;
        const long UIA_InputReachedOtherElementEventId                   = 20021;
        const long UIA_InputDiscardedEventId                             = 20022;
    };

    [dllname("<no entry points>")]
    module UIA_PropertyIds
    {
        const long UIA_RuntimeIdPropertyId                            = 30000;
        const long UIA_BoundingRectanglePropertyId                    = 30001;
        const long UIA_ProcessIdPropertyId                            = 30002;
        const long UIA_ControlTypePropertyId                          = 30003;
        const long UIA_LocalizedControlTypePropertyId                 = 30004;
        const long UIA_NamePropertyId                                 = 30005;
        const long UIA_AcceleratorKeyPropertyId                       = 30006;
        const long UIA_AccessKeyPropertyId                            = 30007;
        const long UIA_HasKeyboardFocusPropertyId                     = 30008;
        const long UIA_IsKeyboardFocusablePropertyId                  = 30009;
        const long UIA_IsEnabledPropertyId                            = 30010;
        const long UIA_AutomationIdPropertyId                         = 30011;
        const long UIA_ClassNamePropertyId                            = 30012;
        const long UIA_HelpTextPropertyId                             = 30013;
        const long UIA_ClickablePointPropertyId                       = 30014;
        const long UIA_CulturePropertyId                              = 30015;
        const long UIA_IsControlElementPropertyId                     = 30016;
        const long UIA_IsContentElementPropertyId                     = 30017;
        const long UIA_LabeledByPropertyId                            = 30018;
        const long UIA_IsPasswordPropertyId                           = 30019;
        const long UIA_NativeWindowHandlePropertyId                   = 30020;
        const long UIA_ItemTypePropertyId                             = 30021;
        const long UIA_IsOffscreenPropertyId                          = 30022;
        const long UIA_OrientationPropertyId                          = 30023;
        const long UIA_FrameworkIdPropertyId                          = 30024;
        const long UIA_IsRequiredForFormPropertyId                    = 30025;
        const long UIA_ItemStatusPropertyId                           = 30026;
        const long UIA_IsDockPatternAvailablePropertyId               = 30027;
        const long UIA_IsExpandCollapsePatternAvailablePropertyId     = 30028;
        const long UIA_IsGridItemPatternAvailablePropertyId           = 30029;
        const long UIA_IsGridPatternAvailablePropertyId               = 30030;
        const long UIA_IsInvokePatternAvailablePropertyId             = 30031;
        const long UIA_IsMultipleViewPatternAvailablePropertyId       = 30032;
        const long UIA_IsRangeValuePatternAvailablePropertyId         = 30033;
        const long UIA_IsScrollPatternAvailablePropertyId             = 30034;
        const long UIA_IsScrollItemPatternAvailablePropertyId         = 30035;
        const long UIA_IsSelectionItemPatternAvailablePropertyId      = 30036;
        const long UIA_IsSelectionPatternAvailablePropertyId          = 30037;
        const long UIA_IsTablePatternAvailablePropertyId              = 30038;
        const long UIA_IsTableItemPatternAvailablePropertyId          = 30039;
        const long UIA_IsTextPatternAvailablePropertyId               = 30040;
        const long UIA_IsTogglePatternAvailablePropertyId             = 30041;
        const long UIA_IsTransformPatternAvailablePropertyId          = 30042;
        const long UIA_IsValuePatternAvailablePropertyId              = 30043;
        const long UIA_IsWindowPatternAvailablePropertyId             = 30044;
        const long UIA_ValueValuePropertyId                           = 30045;
        const long UIA_ValueIsReadOnlyPropertyId                      = 30046;
        const long UIA_RangeValueValuePropertyId                      = 30047;
        const long UIA_RangeValueIsReadOnlyPropertyId                 = 30048;
        const long UIA_RangeValueMinimumPropertyId                    = 30049;
        const long UIA_RangeValueMaximumPropertyId                    = 30050;
        const long UIA_RangeValueLargeChangePropertyId                = 30051;
        const long UIA_RangeValueSmallChangePropertyId                = 30052;
        const long UIA_ScrollHorizontalScrollPercentPropertyId        = 30053;
        const long UIA_ScrollHorizontalViewSizePropertyId             = 30054;
        const long UIA_ScrollVerticalScrollPercentPropertyId          = 30055;
        const long UIA_ScrollVerticalViewSizePropertyId               = 30056;
        const long UIA_ScrollHorizontallyScrollablePropertyId         = 30057;
        const long UIA_ScrollVerticallyScrollablePropertyId           = 30058;
        const long UIA_SelectionSelectionPropertyId                   = 30059;
        const long UIA_SelectionCanSelectMultiplePropertyId           = 30060;
        const long UIA_SelectionIsSelectionRequiredPropertyId         = 30061;
        const long UIA_GridRowCountPropertyId                         = 30062;
        const long UIA_GridColumnCountPropertyId                      = 30063;
        const long UIA_GridItemRowPropertyId                          = 30064;
        const long UIA_GridItemColumnPropertyId                       = 30065;
        const long UIA_GridItemRowSpanPropertyId                      = 30066;
        const long UIA_GridItemColumnSpanPropertyId                   = 30067;
        const long UIA_GridItemContainingGridPropertyId               = 30068;
        const long UIA_DockDockPositionPropertyId                     = 30069;
        const long UIA_ExpandCollapseExpandCollapseStatePropertyId    = 30070;
        const long UIA_MultipleViewCurrentViewPropertyId              = 30071;
        const long UIA_MultipleViewSupportedViewsPropertyId           = 30072;
        const long UIA_WindowCanMaximizePropertyId                    = 30073;
        const long UIA_WindowCanMinimizePropertyId                    = 30074;
        const long UIA_WindowWindowVisualStatePropertyId              = 30075;
        const long UIA_WindowWindowInteractionStatePropertyId         = 30076;
        const long UIA_WindowIsModalPropertyId                        = 30077;
        const long UIA_WindowIsTopmostPropertyId                      = 30078;
        const long UIA_SelectionItemIsSelectedPropertyId              = 30079;
        const long UIA_SelectionItemSelectionContainerPropertyId      = 30080;
        const long UIA_TableRowHeadersPropertyId                      = 30081;
        const long UIA_TableColumnHeadersPropertyId                   = 30082;
        const long UIA_TableRowOrColumnMajorPropertyId                = 30083;
        const long UIA_TableItemRowHeaderItemsPropertyId              = 30084;
        const long UIA_TableItemColumnHeaderItemsPropertyId           = 30085;
        const long UIA_ToggleToggleStatePropertyId                    = 30086;
        const long UIA_TransformCanMovePropertyId                     = 30087;
        const long UIA_TransformCanResizePropertyId                   = 30088;
        const long UIA_TransformCanRotatePropertyId                   = 30089;
        const long UIA_IsLegacyIAccessiblePatternAvailablePropertyId  = 30090;
        const long UIA_LegacyIAccessibleChildIdPropertyId             = 30091;
        const long UIA_LegacyIAccessibleNamePropertyId                = 30092;
        const long UIA_LegacyIAccessibleValuePropertyId               = 30093;
        const long UIA_LegacyIAccessibleDescriptionPropertyId         = 30094;
        const long UIA_LegacyIAccessibleRolePropertyId                = 30095;
        const long UIA_LegacyIAccessibleStatePropertyId               = 30096;
        const long UIA_LegacyIAccessibleHelpPropertyId                = 30097;
        const long UIA_LegacyIAccessibleKeyboardShortcutPropertyId    = 30098;
        const long UIA_LegacyIAccessibleSelectionPropertyId           = 30099;
        const long UIA_LegacyIAccessibleDefaultActionPropertyId       = 30100;
        const long UIA_AriaRolePropertyId                             = 30101;
        const long UIA_AriaPropertiesPropertyId                       = 30102;
        const long UIA_IsDataValidForFormPropertyId                   = 30103;
        const long UIA_ControllerForPropertyId                        = 30104;
        const long UIA_DescribedByPropertyId                          = 30105;
        const long UIA_FlowsToPropertyId                              = 30106;
        const long UIA_ProviderDescriptionPropertyId                  = 30107;
        const long UIA_IsItemContainerPatternAvailablePropertyId      = 30108;
        const long UIA_IsVirtualizedItemPatternAvailablePropertyId    = 30109;
        const long UIA_IsSynchronizedInputPatternAvailablePropertyId  = 30110;
    }

    [dllname("<no entry points>")]
    module UIA_TextAttributeIds
    {
        const long UIA_AnimationStyleAttributeId             = 40000;
        const long UIA_BackgroundColorAttributeId            = 40001;
        const long UIA_BulletStyleAttributeId                = 40002;
        const long UIA_CapStyleAttributeId                   = 40003;
        const long UIA_CultureAttributeId                    = 40004;
        const long UIA_FontNameAttributeId                   = 40005;
        const long UIA_FontSizeAttributeId                   = 40006;
        const long UIA_FontWeightAttributeId                 = 40007;
        const long UIA_ForegroundColorAttributeId            = 40008;
        const long UIA_HorizontalTextAlignmentAttributeId    = 40009;
        const long UIA_IndentationFirstLineAttributeId       = 40010;
        const long UIA_IndentationLeadingAttributeId         = 40011;
        const long UIA_IndentationTrailingAttributeId        = 40012;
        const long UIA_IsHiddenAttributeId                   = 40013;
        const long UIA_IsItalicAttributeId                   = 40014;
        const long UIA_IsReadOnlyAttributeId                 = 40015;
        const long UIA_IsSubscriptAttributeId                = 40016;
        const long UIA_IsSuperscriptAttributeId              = 40017;
        const long UIA_MarginBottomAttributeId               = 40018;
        const long UIA_MarginLeadingAttributeId              = 40019;
        const long UIA_MarginTopAttributeId                  = 40020;
        const long UIA_MarginTrailingAttributeId             = 40021;
        const long UIA_OutlineStylesAttributeId              = 40022;
        const long UIA_OverlineColorAttributeId              = 40023;
        const long UIA_OverlineStyleAttributeId              = 40024;
        const long UIA_StrikethroughColorAttributeId         = 40025;
        const long UIA_StrikethroughStyleAttributeId         = 40026;
        const long UIA_TabsAttributeId                       = 40027;
        const long UIA_TextFlowDirectionsAttributeId         = 40028;
        const long UIA_UnderlineColorAttributeId             = 40029;
        const long UIA_UnderlineStyleAttributeId             = 40030;
    }

    [dllname("<no entry points>")]
    module UIA_ControlTypeIds
    {
        const long UIA_ButtonControlTypeId        = 50000;
        const long UIA_CalendarControlTypeId      = 50001;
        const long UIA_CheckBoxControlTypeId      = 50002;
        const long UIA_ComboBoxControlTypeId      = 50003;
        const long UIA_EditControlTypeId          = 50004;
        const long UIA_HyperlinkControlTypeId     = 50005;
        const long UIA_ImageControlTypeId         = 50006;
        const long UIA_ListItemControlTypeId      = 50007;
        const long UIA_ListControlTypeId          = 50008;
        const long UIA_MenuControlTypeId          = 50009;
        const long UIA_MenuBarControlTypeId       = 50010;
        const long UIA_MenuItemControlTypeId      = 50011;
        const long UIA_ProgressBarControlTypeId   = 50012;
        const long UIA_RadioButtonControlTypeId   = 50013;
        const long UIA_ScrollBarControlTypeId     = 50014;
        const long UIA_SliderControlTypeId        = 50015;
        const long UIA_SpinnerControlTypeId       = 50016;
        const long UIA_StatusBarControlTypeId     = 50017;
        const long UIA_TabControlTypeId           = 50018;
        const long UIA_TabItemControlTypeId       = 50019;
        const long UIA_TextControlTypeId          = 50020;
        const long UIA_ToolBarControlTypeId       = 50021;
        const long UIA_ToolTipControlTypeId       = 50022;
        const long UIA_TreeControlTypeId          = 50023;
        const long UIA_TreeItemControlTypeId      = 50024;
        const long UIA_CustomControlTypeId        = 50025;
        const long UIA_GroupControlTypeId         = 50026;
        const long UIA_ThumbControlTypeId         = 50027;
        const long UIA_DataGridControlTypeId      = 50028;
        const long UIA_DataItemControlTypeId      = 50029;
        const long UIA_DocumentControlTypeId      = 50030;
        const long UIA_SplitButtonControlTypeId   = 50031;
        const long UIA_WindowControlTypeId        = 50032;
        const long UIA_PaneControlTypeId          = 50033;
        const long UIA_HeaderControlTypeId        = 50034;
        const long UIA_HeaderItemControlTypeId    = 50035;
        const long UIA_TableControlTypeId         = 50036;
        const long UIA_TitleBarControlTypeId      = 50037;
        const long UIA_SeparatorControlTypeId     = 50038;
    };

    interface IUIAutomationElement;
    interface IUIAutomationElementArray;

    //
    //  IUIAutomationCondition
    //
    [object, uuid(352ffba8-0973-437c-a61f-f64cafd81df9), pointer_default(unique)]
    interface IUIAutomationCondition : IUnknown
    {
    }

    //
    //  IUIAutomationBoolCondition
    //
    [object, uuid(1b4e1f2e-75eb-4d0b-8952-5a69988e2307), pointer_default(unique)]
    interface IUIAutomationBoolCondition : IUIAutomationCondition
    {
        [propget] HRESULT BooleanValue (
            [out, retval] BOOL * boolVal );
    }

    //
    //  IUIAutomationPropertyCondition
    //
    [object, uuid(99ebf2cb-5578-4267-9ad4-afd6ea77e94b), pointer_default(unique)]
    interface IUIAutomationPropertyCondition : IUIAutomationCondition
    {
        [propget] HRESULT PropertyId (
            [out, retval] PROPERTYID * propertyId );

        [propget] HRESULT PropertyValue (
            [out, retval] VARIANT * propertyValue );

        [propget] HRESULT PropertyConditionFlags (
            [out, retval] enum PropertyConditionFlags * flags );
    }

    //
    //  IUIAutomationAndCondition
    //
    [object, uuid(a7d0af36-b912-45fe-9855-091ddc174aec), pointer_default(unique)]
    interface IUIAutomationAndCondition : IUIAutomationCondition
    {
        [propget] HRESULT ChildCount (
            [out, retval] int * childCount );

        HRESULT GetChildrenAsNativeArray (
            [out, size_is( ,*childArrayCount)] IUIAutomationCondition *** childArray,
            [out] int * childArrayCount );

        HRESULT GetChildren (
            [out, retval] SAFEARRAY(IUIAutomationCondition) * childArray );
    }

    //
    //  IUIAutomationOrCondition
    //
    [object, uuid(8753f032-3db1-47b5-a1fc-6e34a266c712), pointer_default(unique)]
    interface IUIAutomationOrCondition : IUIAutomationCondition
    {
        [propget] HRESULT ChildCount (
            [out, retval] int * childCount );

        HRESULT GetChildrenAsNativeArray (
            [out, size_is( ,*childArrayCount)] IUIAutomationCondition *** childArray,
            [out] int * childArrayCount );

        HRESULT GetChildren (
            [out, retval] SAFEARRAY(IUIAutomationCondition) * childArray );
    }

    //
    //  IUIAutomationNotCondition
    //
    [object, uuid(f528b657-847b-498c-8896-d52b565407a1), pointer_default(unique)]
    interface IUIAutomationNotCondition : IUIAutomationCondition
    {
        HRESULT GetChild(
            [out, retval] IUIAutomationCondition ** condition );
    }

    //
    //  IUIAutomationCacheRequest
    //
    [object, uuid(b32a92b5-bc25-4078-9c08-d7ee95c48e03), pointer_default(unique)]
    interface IUIAutomationCacheRequest : IUnknown
    {
        HRESULT AddProperty (
            [in] PROPERTYID propertyId );

        HRESULT AddPattern (
            [in] PATTERNID patternId );

        HRESULT Clone (
            [out, retval] IUIAutomationCacheRequest ** clonedRequest );

        [propget] HRESULT TreeScope (
            [out, retval] enum TreeScope * scope );

        [propput] HRESULT TreeScope (
            [in] enum TreeScope scope );

        [propget] HRESULT TreeFilter (
            [out, retval] IUIAutomationCondition ** filter );

        [propput] HRESULT TreeFilter (
            [in] IUIAutomationCondition * filter );

        [propget] HRESULT AutomationElementMode (
            [out, retval] enum AutomationElementMode * mode );

        [propput] HRESULT AutomationElementMode (
            [in] enum AutomationElementMode mode );

    }

    //
    //  IUIAutomationTreeWalker
    //
    [object, uuid(4042c624-389c-4afc-a630-9df854a541fc), pointer_default(unique)]
    interface IUIAutomationTreeWalker : IUnknown
    {
        HRESULT GetParentElement (
            [in] IUIAutomationElement * element,
            [out, retval] IUIAutomationElement ** parent );

        HRESULT GetFirstChildElement (
            [in] IUIAutomationElement * element,
            [out, retval] IUIAutomationElement ** first );

        HRESULT GetLastChildElement (
            [in] IUIAutomationElement * element,
            [out, retval] IUIAutomationElement ** last );

        HRESULT GetNextSiblingElement (
            [in] IUIAutomationElement * element,
            [out, retval] IUIAutomationElement ** next );

        HRESULT GetPreviousSiblingElement (
            [in] IUIAutomationElement * element,
            [out, retval] IUIAutomationElement ** previous );

        HRESULT NormalizeElement (
            [in] IUIAutomationElement * element,
            [out, retval] IUIAutomationElement ** normalized );


        // Separate * CacheRequest names exist, because there’s no name overloading in COM
        HRESULT GetParentElementBuildCache (
            [in] IUIAutomationElement * element,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** parent );

        HRESULT GetFirstChildElementBuildCache (
            [in] IUIAutomationElement * element,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** first );

        HRESULT GetLastChildElementBuildCache (
            [in] IUIAutomationElement * element,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** last );

        HRESULT GetNextSiblingElementBuildCache (
            [in] IUIAutomationElement * element,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** next );

        HRESULT GetPreviousSiblingElementBuildCache (
            [in] IUIAutomationElement * element,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** previous );

        HRESULT NormalizeElementBuildCache (
            [in] IUIAutomationElement * element,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** normalized );


        [propget] HRESULT Condition (
            [out, retval] IUIAutomationCondition ** condition );

    }

    //
    //  IUIAutomationEventHandler
    //
    [object, uuid(146c3c17-f12e-4e22-8c27-f894b9b79c69), pointer_default(unique), oleautomation]
    interface IUIAutomationEventHandler : IUnknown
    {
        HRESULT HandleAutomationEvent (
            [in] IUIAutomationElement * sender,
            [in] EVENTID eventId );
    }

    //
    //  IUIAutomationPropertyChangedEventHandler
    //
    [object, uuid(40cd37d4-c756-4b0c-8c6f-bddfeeb13b50), pointer_default(unique), oleautomation]
    interface IUIAutomationPropertyChangedEventHandler : IUnknown
    {
        HRESULT HandlePropertyChangedEvent (
            [in] IUIAutomationElement * sender,
            [in] PROPERTYID propertyId,
            [in] VARIANT newValue );
    }

    //
    //  IUIAutomationStructureChangedEventHandler
    //
    [object, uuid(e81d1b4e-11c5-42f8-9754-e7036c79f054), pointer_default(unique), oleautomation]
    interface IUIAutomationStructureChangedEventHandler : IUnknown
    {
        HRESULT HandleStructureChangedEvent (
            [in] IUIAutomationElement * sender,
            [in] enum StructureChangeType changeType,
            [in] SAFEARRAY(int) runtimeId );
    }

    //
    //  IUIAutomationFocusChangedEventHandler
    //
    [object, uuid(c270f6b5-5c69-4290-9745-7a7f97169468), pointer_default(unique), oleautomation]
    interface IUIAutomationFocusChangedEventHandler : IUnknown
    {
        HRESULT HandleFocusChangedEvent (
            [in] IUIAutomationElement * sender );
    }

    //
    //  IUIAutomationInvokePattern
    //
    [object, uuid(fb377fbe-8ea6-46d5-9c73-6499642d3059), pointer_default(unique)]
    interface IUIAutomationInvokePattern : IUnknown
    {
        HRESULT Invoke ( );

    }

    //
    //  IUIAutomationDockPattern
    //
    [object, uuid(fde5ef97-1464-48f6-90bf-43d0948e86ec), pointer_default(unique)]
    interface IUIAutomationDockPattern : IUnknown
    {
        HRESULT SetDockPosition (
            [in] enum DockPosition dockPos );

        [propget] HRESULT CurrentDockPosition (
            [out, retval] enum DockPosition * retVal );

        [propget] HRESULT CachedDockPosition (
            [out, retval] enum DockPosition * retVal );
    }

    //
    //  IUIAutomationExpandCollapsePattern
    //
    [object, uuid(619be086-1f4e-4ee4-bafa-210128738730), pointer_default(unique)]
    interface IUIAutomationExpandCollapsePattern : IUnknown
    {
        HRESULT Expand ( );

        HRESULT Collapse ( );

        [propget] HRESULT CurrentExpandCollapseState (
            [out, retval] enum ExpandCollapseState * retVal );

        [propget] HRESULT CachedExpandCollapseState (
            [out, retval] enum ExpandCollapseState * retVal );
    }

    //
    //  IUIAutomationGridPattern
    //
    [object, uuid(414c3cdc-856b-4f5b-8538-3131c6302550), pointer_default(unique)]
    interface IUIAutomationGridPattern : IUnknown
    {
        HRESULT GetItem (
            [in] int row,
            [in] int column,
            [out, retval] IUIAutomationElement ** element );

        [propget] HRESULT CurrentRowCount (
            [out, retval] int * retVal );

        [propget] HRESULT CurrentColumnCount (
            [out, retval] int * retVal );

        [propget] HRESULT CachedRowCount (
            [out, retval] int * retVal );

        [propget] HRESULT CachedColumnCount (
            [out, retval] int * retVal );
    }

    //
    //  IUIAutomationGridItemPattern
    //
    [object, uuid(78f8ef57-66c3-4e09-bd7c-e79b2004894d), pointer_default(unique)]
    interface IUIAutomationGridItemPattern : IUnknown
    {
        [propget] HRESULT CurrentContainingGrid (
            [out, retval] IUIAutomationElement ** retVal );

        [propget] HRESULT CurrentRow (
            [out, retval] int * retVal );

        [propget] HRESULT CurrentColumn (
            [out, retval] int * retVal );

        [propget] HRESULT CurrentRowSpan (
            [out, retval] int * retVal );

        [propget] HRESULT CurrentColumnSpan (
            [out, retval] int * retVal );

        [propget] HRESULT CachedContainingGrid (
            [out, retval] IUIAutomationElement ** retVal );

        [propget] HRESULT CachedRow (
            [out, retval] int * retVal );

        [propget] HRESULT CachedColumn (
            [out, retval] int * retVal );

        [propget] HRESULT CachedRowSpan (
            [out, retval] int * retVal );

        [propget] HRESULT CachedColumnSpan (
            [out, retval] int * retVal );
    }

    //
    //  IUIAutomationMultipleViewPattern
    //
    [object, uuid(8d253c91-1dc5-4bb5-b18f-ade16fa495e8), pointer_default(unique)]
    interface IUIAutomationMultipleViewPattern : IUnknown
    {
        HRESULT GetViewName (
            [in] int view,
            [out, retval] BSTR * name );

        HRESULT SetCurrentView (
            [in] int view );

        [propget] HRESULT CurrentCurrentView (
            [out, retval] int * retVal );

        HRESULT GetCurrentSupportedViews (
            [out, retval] SAFEARRAY(int) * retVal );

        [propget] HRESULT CachedCurrentView (
            [out, retval] int * retVal );

        HRESULT GetCachedSupportedViews (
            [out, retval] SAFEARRAY(int) * retVal );
    }

    //
    //  IUIAutomationRangeValuePattern
    //
    [object, uuid(59213f4f-7346-49e5-b120-80555987a148), pointer_default(unique)]
    interface IUIAutomationRangeValuePattern : IUnknown
    {
        HRESULT SetValue (
            [in] double val );

        [propget] HRESULT CurrentValue (
            [out, retval] double * retVal );

        [propget] HRESULT CurrentIsReadOnly (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentMaximum (
            [out, retval] double * retVal );

        [propget] HRESULT CurrentMinimum (
            [out, retval] double * retVal );

        [propget] HRESULT CurrentLargeChange (
            [out, retval] double * retVal );

        [propget] HRESULT CurrentSmallChange (
            [out, retval] double * retVal );

        [propget] HRESULT CachedValue (
            [out, retval] double * retVal );

        [propget] HRESULT CachedIsReadOnly (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedMaximum (
            [out, retval] double * retVal );

        [propget] HRESULT CachedMinimum (
            [out, retval] double * retVal );

        [propget] HRESULT CachedLargeChange (
            [out, retval] double * retVal );

        [propget] HRESULT CachedSmallChange (
            [out, retval] double * retVal );
    }

    //
    //  IUIAutomationScrollPattern
    //
    [object, uuid(88f4d42a-e881-459d-a77c-73bbbb7e02dc), pointer_default(unique)]
    interface IUIAutomationScrollPattern : IUnknown
    {
        HRESULT Scroll (
            [in] enum ScrollAmount horizontalAmount,
            [in] enum ScrollAmount verticalAmount );

        HRESULT SetScrollPercent (
            [in] double horizontalPercent,
            [in] double verticalPercent );

        [propget] HRESULT CurrentHorizontalScrollPercent (
            [out, retval] double * retVal );

        [propget] HRESULT CurrentVerticalScrollPercent (
            [out, retval] double * retVal );

        [propget] HRESULT CurrentHorizontalViewSize (
            [out, retval] double * retVal );

        [propget] HRESULT CurrentVerticalViewSize (
            [out, retval] double * retVal );

        [propget] HRESULT CurrentHorizontallyScrollable (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentVerticallyScrollable (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedHorizontalScrollPercent (
            [out, retval] double * retVal );

        [propget] HRESULT CachedVerticalScrollPercent (
            [out, retval] double * retVal );

        [propget] HRESULT CachedHorizontalViewSize (
            [out, retval] double * retVal );

        [propget] HRESULT CachedVerticalViewSize (
            [out, retval] double * retVal );

        [propget] HRESULT CachedHorizontallyScrollable (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedVerticallyScrollable (
            [out, retval] BOOL * retVal );
    }

    //
    //  IUIAutomationScrollItemPattern
    //
    [object, uuid(b488300f-d015-4f19-9c29-bb595e3645ef), pointer_default(unique)]
    interface IUIAutomationScrollItemPattern : IUnknown
    {
        HRESULT ScrollIntoView (  );
    }

    //
    //  IUIAutomationSelectionPattern
    //
    [object, uuid(5ed5202e-b2ac-47a6-b638-4b0bf140d78e), pointer_default(unique)]
    interface IUIAutomationSelectionPattern : IUnknown
    {
        HRESULT GetCurrentSelection (
            [out, retval] IUIAutomationElementArray ** retVal );

        [propget] HRESULT CurrentCanSelectMultiple (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentIsSelectionRequired (
            [out, retval] BOOL * retVal );

        HRESULT GetCachedSelection (
            [out, retval] IUIAutomationElementArray ** retVal );

        [propget] HRESULT CachedCanSelectMultiple (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedIsSelectionRequired (
            [out, retval] BOOL * retVal );
    }

    //
    //  IUIAutomationSelectionItemPattern
    //
    [object, uuid(a8efa66a-0fda-421a-9194-38021f3578ea), pointer_default(unique)]
    interface IUIAutomationSelectionItemPattern : IUnknown
    {
        HRESULT Select ( );

        HRESULT AddToSelection ( );

        HRESULT RemoveFromSelection ( );

        [propget] HRESULT CurrentIsSelected (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentSelectionContainer (
            [out, retval] IUIAutomationElement ** retVal );

        [propget] HRESULT CachedIsSelected (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedSelectionContainer (
            [out, retval] IUIAutomationElement ** retVal );
    }

    //
    //  IUIAutomationSynchronizedInputPattern
    //
    [object, uuid(2233be0b-afb7-448b-9fda-3b378aa5eae1), pointer_default(unique)]
    interface IUIAutomationSynchronizedInputPattern : IUnknown
    {
        HRESULT StartListening (
            [in] enum SynchronizedInputType inputType );

        HRESULT Cancel ( );
    }


    //
    //  IUIAutomationTablePattern
    //
    [object, uuid(620e691c-ea96-4710-a850-754b24ce2417), pointer_default(unique)]
    interface IUIAutomationTablePattern : IUnknown
    {
        HRESULT GetCurrentRowHeaders (
            [out, retval] IUIAutomationElementArray ** retVal );

        HRESULT GetCurrentColumnHeaders (
            [out, retval] IUIAutomationElementArray ** retVal );

        [propget] HRESULT CurrentRowOrColumnMajor (
            [out, retval] enum RowOrColumnMajor * retVal );

        HRESULT GetCachedRowHeaders (
            [out, retval] IUIAutomationElementArray ** retVal );

        HRESULT GetCachedColumnHeaders (
            [out, retval] IUIAutomationElementArray ** retVal );

        [propget] HRESULT CachedRowOrColumnMajor (
            [out, retval] enum RowOrColumnMajor * retVal );
    }

    //
    //  IUIAutomationTableItemPattern
    //
    [object, uuid(0b964eb3-ef2e-4464-9c79-61d61737a27e), pointer_default(unique)]
    interface IUIAutomationTableItemPattern : IUnknown
    {
        HRESULT GetCurrentRowHeaderItems (
            [out, retval] IUIAutomationElementArray ** retVal );

        HRESULT GetCurrentColumnHeaderItems (
            [out, retval] IUIAutomationElementArray ** retVal );

        HRESULT GetCachedRowHeaderItems (
            [out, retval] IUIAutomationElementArray ** retVal );

        HRESULT GetCachedColumnHeaderItems (
            [out, retval] IUIAutomationElementArray ** retVal );
    }

    //
    //  IUIAutomationTogglePattern
    //
    [object, uuid(94cf8058-9b8d-4ab9-8bfd-4cd0a33c8c70), pointer_default(unique)]
    interface IUIAutomationTogglePattern : IUnknown
    {
        HRESULT Toggle ( );

        [propget] HRESULT CurrentToggleState (
            [out, retval] enum ToggleState * retVal );

        [propget] HRESULT CachedToggleState (
            [out, retval] enum ToggleState * retVal );
    }

    //
    //  IUIAutomationTransformPattern
    //
    [object, uuid(a9b55844-a55d-4ef0-926d-569c16ff89bb), pointer_default(unique)]
    interface IUIAutomationTransformPattern : IUnknown
    {
        HRESULT Move (
            [in] double x,
            [in] double y );

        HRESULT Resize (
            [in] double width,
            [in] double height );

        HRESULT Rotate (
            [in] double degrees );

        [propget] HRESULT CurrentCanMove (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentCanResize (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentCanRotate (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedCanMove (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedCanResize (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedCanRotate (
            [out, retval] BOOL * retVal );
    }

    //
    //  IUIAutomationValuePattern
    //
    [object, uuid(a94cd8b1-0844-4cd6-9d2d-640537ab39e9), pointer_default(unique)]
    interface IUIAutomationValuePattern : IUnknown
    {
        HRESULT SetValue (
            [in] BSTR val );

        [propget] HRESULT CurrentValue (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentIsReadOnly (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedValue (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedIsReadOnly (
            [out, retval] BOOL * retVal );
    }

    //
    //  IUIAutomationWindowPattern
    //
    [object, uuid(0faef453-9208-43ef-bbb2-3b485177864f), pointer_default(unique)]
    interface IUIAutomationWindowPattern : IUnknown
    {
        HRESULT Close ( );

        HRESULT WaitForInputIdle (
            [in] int milliseconds,
            [out, retval] BOOL * success );

        HRESULT SetWindowVisualState (
            [in] enum WindowVisualState state );

        [propget] HRESULT CurrentCanMaximize (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentCanMinimize (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentIsModal (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentIsTopmost (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentWindowVisualState (
            [out, retval] enum WindowVisualState * retVal );

        [propget] HRESULT CurrentWindowInteractionState (
            [out, retval] enum WindowInteractionState * retVal );

        [propget] HRESULT CachedCanMaximize (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedCanMinimize (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedIsModal (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedIsTopmost (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedWindowVisualState (
            [out, retval] enum WindowVisualState * retVal );

        [propget] HRESULT CachedWindowInteractionState (
            [out, retval] enum WindowInteractionState * retVal );
    }


    //
    //  IUIAutomationTextRange
    //
    [object, uuid(a543cc6a-f4ae-494b-8239-c814481187a8), pointer_default(unique)]
    interface IUIAutomationTextRange : IUnknown
    {
        HRESULT Clone (
            [out, retval] IUIAutomationTextRange ** clonedRange );

        HRESULT Compare (
            [in] IUIAutomationTextRange * range,
            [out, retval] BOOL * areSame );

        HRESULT CompareEndpoints (
            [in] enum TextPatternRangeEndpoint srcEndPoint,
            [in] IUIAutomationTextRange * range,
            [in] enum TextPatternRangeEndpoint targetEndPoint,
            [out, retval] int * compValue );

        HRESULT ExpandToEnclosingUnit (
            [in] enum TextUnit textUnit );

        HRESULT FindAttribute (
            [in] TEXTATTRIBUTEID attr,
            [in] VARIANT val,
            [in] BOOL backward,
            [out, retval] IUIAutomationTextRange ** found );

        HRESULT FindText (
            [in] BSTR text,
            [in] BOOL backward,
            [in] BOOL ignoreCase,
            [out, retval] IUIAutomationTextRange ** found );

        HRESULT GetAttributeValue (
            [in] TEXTATTRIBUTEID attr,
            [out, retval] VARIANT * value );

        HRESULT GetBoundingRectangles (
            [out, retval] SAFEARRAY(double) * boundingRects );

        HRESULT GetEnclosingElement (
            [out, retval] IUIAutomationElement ** enclosingElement );

        HRESULT GetText (
            [in] int maxLength,
            [out, retval] BSTR * text );

        HRESULT Move (
            [in] enum TextUnit unit,
            [in] int count,
            [out, retval] int * moved );

        HRESULT MoveEndpointByUnit (
            [in] enum TextPatternRangeEndpoint endpoint,
            [in] enum TextUnit unit,
            [in] int count,
            [out, retval] int * moved );

        HRESULT MoveEndpointByRange (
            [in] enum TextPatternRangeEndpoint srcEndPoint,
            [in] IUIAutomationTextRange * range,
            [in] enum TextPatternRangeEndpoint targetEndPoint );

        HRESULT Select (  );

        HRESULT AddToSelection (  );

        HRESULT RemoveFromSelection (  );

        HRESULT ScrollIntoView (
            [in] BOOL alignToTop );

        HRESULT GetChildren (
            [out, retval] IUIAutomationElementArray ** children );

    }

    //
    //  IUIAutomationTextRangeArray
    //
    [object, uuid(ce4ae76a-e717-4c98-81ea-47371d028eb6), pointer_default(unique)]
    interface IUIAutomationTextRangeArray : IUnknown
    {
        [propget] HRESULT Length (
            [out, retval] int * length );

        HRESULT GetElement (
            [in] int index,
            [out, retval] IUIAutomationTextRange ** element );

    }

    //
    //  IUIAutomationTextPattern
    //
    [object, uuid(32eba289-3583-42c9-9c59-3b6d9a1e9b6a), pointer_default(unique)]
    interface IUIAutomationTextPattern : IUnknown
    {
        HRESULT RangeFromPoint (
            [in] POINT pt,
            [out, retval] IUIAutomationTextRange ** range );

        HRESULT RangeFromChild (
            [in] IUIAutomationElement * child,
            [out, retval] IUIAutomationTextRange ** range );

        HRESULT GetSelection (
            [out, retval] IUIAutomationTextRangeArray ** ranges );

        HRESULT GetVisibleRanges (
            [out, retval] IUIAutomationTextRangeArray ** ranges );

        [propget] HRESULT DocumentRange (
            [out, retval] IUIAutomationTextRange ** range );

        [propget] HRESULT SupportedTextSelection (
            [out, retval] enum SupportedTextSelection * supportedTextSelection );

    }

    //
    //  IUIAutomationLegacyIAccessiblePattern
    //

    // Parameter names are intentionally kept the same as IAccessible
    [object, uuid(828055ad-355b-4435-86d5-3b51c14a9b1b), pointer_default(unique)]
    interface IUIAutomationLegacyIAccessiblePattern: IUnknown
    {
        HRESULT Select ( long flagsSelect );

        HRESULT DoDefaultAction ();

        HRESULT SetValue ( LPCWSTR szValue );

        [propget] HRESULT CurrentChildId (
            [out, retval] int * pRetVal );

        [propget] HRESULT CurrentName (
            [out, retval] BSTR * pszName );

        [propget] HRESULT CurrentValue (
            [out, retval] BSTR * pszValue );

        [propget] HRESULT CurrentDescription (
            [out, retval] BSTR * pszDescription );

        [propget] HRESULT CurrentRole (
            [out, retval] DWORD * pdwRole );

        [propget] HRESULT CurrentState (
            [out, retval] DWORD * pdwState );

        [propget] HRESULT CurrentHelp (
            [out, retval] BSTR * pszHelp );

        [propget] HRESULT CurrentKeyboardShortcut (
            [out, retval] BSTR * pszKeyboardShortcut );

        HRESULT GetCurrentSelection (
            [out, retval] IUIAutomationElementArray ** pvarSelectedChildren );

        [propget] HRESULT CurrentDefaultAction (
            [out, retval] BSTR * pszDefaultAction );

        [propget] HRESULT CachedChildId (
            [out, retval] int * pRetVal );

        [propget] HRESULT CachedName (
            [out, retval] BSTR * pszName );

        [propget] HRESULT CachedValue (
            [out, retval] BSTR * pszValue );

        [propget] HRESULT CachedDescription (
            [out, retval] BSTR * pszDescription );

        [propget] HRESULT CachedRole (
            [out, retval] DWORD * pdwRole );

        [propget] HRESULT CachedState (
            [out, retval] DWORD * pdwState );

        [propget] HRESULT CachedHelp (
            [out, retval] BSTR * pszHelp );

        [propget] HRESULT CachedKeyboardShortcut (
            [out, retval] BSTR * pszKeyboardShortcut );

        HRESULT GetCachedSelection (
            [out, retval] IUIAutomationElementArray ** pvarSelectedChildren );

        [propget] HRESULT CachedDefaultAction (
            [out, retval] BSTR * pszDefaultAction );

        HRESULT GetIAccessible ( [out, retval] IAccessible ** ppAccessible );
    };

    [object, uuid(c690fdb2-27a8-423c-812d-429773c9084e), pointer_default(unique)]
    interface IUIAutomationItemContainerPattern : IUnknown
    {
        // Find item by specified property/value. May return actual 
        // AutomationElement or a placeholder if the matching element is
        // virtualized.
        // Returns E_INVALIDARG if the property requested is not one that the
        // container supports searching over. Expected that most containers will
        // support Name property, and if appropriate for the container,
        // AutomationId and IsSelected.
        //
        // This method is expected to be relatively slow, since it may need to
        // traverse multiple objects in order to find a matching one.
        // When used in a loop to return multiple items, no specific order is
        // defined so long as each item is returned only once (ie. loop should
        // terminate). This method is also item-centric, not UI-centric, so items
        // with multiple UI representations need only be returned once.
        //
        // A special propertyId of 0 means 'match all items'. This can be used
        // with pStartAfter=NULL to get the first item, and then to get successive
        // items. Value should be VT_EMPTY in this case.
        HRESULT FindItemByProperty([in] IUIAutomationElement * pStartAfter,
                                   [in] PROPERTYID propertyId,
                                   [in] VARIANT value,
                                   [out, retval] IUIAutomationElement ** pFound);
    };

    [object, uuid(6ba3d7a6-04cf-4f11-8793-a8d1cde9969f), pointer_default(unique)]
    interface IUIAutomationVirtualizedItemPattern : IUnknown
    {
        // Request that a placeholder element make itself fully available. Blocks
        // until element is available, which could take time.
        // Returns S_OK if item is already available.
        // Parent control may scroll as a side effect if the container needs to
        // being the item into view in order to devirtualize it.
        HRESULT Realize();
    };


    //
    //  IUIAutomationElement
    //
    [object, uuid(d22108aa-8ac5-49a5-837b-37bbb3d7591e), pointer_default(unique)]
    interface IUIAutomationElement : IUnknown
    {
        HRESULT SetFocus ( );

        HRESULT GetRuntimeId (
            [out, retval] SAFEARRAY(int) * runtimeId );

        HRESULT FindFirst (
            [in] enum TreeScope scope,
            [in] IUIAutomationCondition * condition,
            [out, retval] IUIAutomationElement ** found );

        HRESULT FindAll (
            [in] enum TreeScope scope,
            [in] IUIAutomationCondition * condition,
            [out, retval] IUIAutomationElementArray ** found );

        HRESULT FindFirstBuildCache (
            [in] enum TreeScope scope,
            [in] IUIAutomationCondition * condition,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** found );

        HRESULT FindAllBuildCache (
            [in] enum TreeScope scope,
            [in] IUIAutomationCondition * condition,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElementArray ** found );

        HRESULT BuildUpdatedCache (
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** updatedElement );

        HRESULT GetCurrentPropertyValue (
            [in] PROPERTYID propertyId,
            [out, retval] VARIANT * retVal);

        HRESULT GetCurrentPropertyValueEx (
            [in] PROPERTYID propertyId,
            [in] BOOL ignoreDefaultValue,
            [out, retval] VARIANT * retVal );

        HRESULT GetCachedPropertyValue (
            [in] PROPERTYID propertyId,
            [out, retval] VARIANT * retVal );

        HRESULT GetCachedPropertyValueEx (
            [in] PROPERTYID propertyId,
            [in] BOOL ignoreDefaultValue,
            [out, retval] VARIANT * retVal );


        // These versions exist to simplify using these methods, avoiding the extra Query
        // Interface step that inevitably follows getting the Pattern.
        HRESULT GetCurrentPatternAs (
            [in] PATTERNID patternId,
            [in] REFIID riid,
            [out, iid_is(riid), retval] void ** patternObject );

        HRESULT GetCachedPatternAs (
            [in] PATTERNID patternId,
            [in] REFIID riid,
            [out, iid_is(riid), retval] void ** patternObject );

        // These versions are better for managed code, or code that wants a generalized
        // handling path, they return as pure IUnknowns
        HRESULT GetCurrentPattern (
            [in] PATTERNID patternId,
            [out, retval] IUnknown ** patternObject );

        HRESULT GetCachedPattern (
            [in] PATTERNID patternId,
            [out, retval] IUnknown ** patternObject );

        HRESULT GetCachedParent (
            [out, retval] IUIAutomationElement ** parent );

        HRESULT GetCachedChildren (
            [out, retval] IUIAutomationElementArray ** children );

        // Current Property Getters (for convenience)
        [propget] HRESULT CurrentProcessId (
            [out, retval] int * retVal );

        [propget] HRESULT CurrentControlType (
            [out, retval] CONTROLTYPEID * retVal );

        [propget] HRESULT CurrentLocalizedControlType (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentName (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentAcceleratorKey (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentAccessKey (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentHasKeyboardFocus (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentIsKeyboardFocusable (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentIsEnabled (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentAutomationId (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentClassName (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentHelpText (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentCulture (
            [out, retval] int * retVal );

        [propget] HRESULT CurrentIsControlElement (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentIsContentElement (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentIsPassword (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentNativeWindowHandle (
            [out, retval] UIA_HWND * retVal );

        [propget] HRESULT CurrentItemType (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentIsOffscreen (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentOrientation (
            [out, retval] enum OrientationType * retVal );

        [propget] HRESULT CurrentFrameworkId (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentIsRequiredForForm (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentItemStatus (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentBoundingRectangle (
            [out, retval] RECT * retVal );

        [propget] HRESULT CurrentLabeledBy (
            [out, retval] IUIAutomationElement ** retVal );        

        [propget] HRESULT CurrentAriaRole (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentAriaProperties (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CurrentIsDataValidForForm (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CurrentControllerFor (
            [out, retval] IUIAutomationElementArray ** retVal ); 

        [propget] HRESULT CurrentDescribedBy (
            [out, retval] IUIAutomationElementArray ** retVal );

        [propget] HRESULT CurrentFlowsTo (
            [out, retval] IUIAutomationElementArray ** retVal );

        [propget] HRESULT CurrentProviderDescription (
            [out, retval] BSTR * retVal );        

        // Cached Property Getters (for convenience)
        [propget] HRESULT CachedProcessId (
            [out, retval] int * retVal );

        [propget] HRESULT CachedControlType (
            [out, retval] CONTROLTYPEID * retVal );

        [propget] HRESULT CachedLocalizedControlType (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedName (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedAcceleratorKey (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedAccessKey (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedHasKeyboardFocus (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedIsKeyboardFocusable (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedIsEnabled (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedAutomationId (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedClassName (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedHelpText (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedCulture (
            [out, retval] int * retVal );

        [propget] HRESULT CachedIsControlElement (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedIsContentElement (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedIsPassword (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedNativeWindowHandle (
            [out, retval] UIA_HWND * retVal );

        [propget] HRESULT CachedItemType (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedIsOffscreen (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedOrientation (
            [out, retval] enum OrientationType * retVal );

        [propget] HRESULT CachedFrameworkId (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedIsRequiredForForm (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedItemStatus (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedBoundingRectangle (
            [out, retval] RECT * retVal );

        [propget] HRESULT CachedLabeledBy (
            [out, retval] IUIAutomationElement ** retVal );

        [propget] HRESULT CachedAriaRole (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedAriaProperties (
            [out, retval] BSTR * retVal );

        [propget] HRESULT CachedIsDataValidForForm (
            [out, retval] BOOL * retVal );

        [propget] HRESULT CachedControllerFor (
            [out, retval] IUIAutomationElementArray ** retVal ); 

        [propget] HRESULT CachedDescribedBy (
            [out, retval] IUIAutomationElementArray ** retVal );

        [propget] HRESULT CachedFlowsTo (
            [out, retval] IUIAutomationElementArray ** retVal );

        [propget] HRESULT CachedProviderDescription (
            [out, retval] BSTR * retVal );        

        // Clickable point helper
        HRESULT GetClickablePoint(
            [out] POINT * clickable,
            [out, retval] BOOL * gotClickable );
    }

    //
    //  IUIAutomationElementArray
    //
    [object, uuid(14314595-b4bc-4055-95f2-58f2e42c9855), pointer_default(unique)]
    interface IUIAutomationElementArray : IUnknown
    {
        [propget] HRESULT Length (
            [out, retval] int * length );

        HRESULT GetElement (
            [in] int index,
            [out, retval] IUIAutomationElement ** element );
    }

    //
    //  IUIAutomationProxyFactory
    //
    [object, uuid(85b94ecd-849d-42b6-b94d-d6db23fdf5a4), pointer_default(unique)]
    interface IUIAutomationProxyFactory : IUnknown
    {
        HRESULT CreateProvider (
            [in] UIA_HWND hwnd,
            [in] LONG idObject,
            [in] LONG idChild,
            [out, retval] IRawElementProviderSimple **provider );

        // The proxy Factory Id is an identifier of the Proxy Factory, it serves several purposes:
        //    - It uniquely identifies a given proxy factory, for ease of finding in the ProxyFactoryMapping
        //    - It is non-localized, so programs can use it to find a given proxy factory in the mapping for removal or position changing
        //    - It identifies which proxy factory created the proxy of a given element, for debugging purposes
        //    - Recommended Format is "Company Name: Proxy Name", to assist with uniqueness
        [propget] HRESULT ProxyFactoryId (
            [out, retval] BSTR *factoryId );
    }


    //
    //  IUIAutomationProxyFactoryEntry
    //
    [object, uuid(d50e472e-b64b-490c-bca1-d30696f9f289), pointer_default(unique)]
    interface IUIAutomationProxyFactoryEntry : IUnknown	 
    {
        [propget] HRESULT ProxyFactory (
            [out, retval] IUIAutomationProxyFactory **factory );

        [propget] HRESULT ClassName (
            [out, retval] BSTR *className );

        [propget] HRESULT ImageName (
            [out, retval] BSTR *imageName );

        [propget] HRESULT AllowSubstringMatch (
            [out, retval] BOOL *allowSubstringMatch );

        [propget] HRESULT CanCheckBaseClass (
            [out, retval] BOOL *canCheckBaseClass );

        [propget] HRESULT NeedsAdviseEvents (
            [out, retval] BOOL *adviseEvents );

        [propput] HRESULT ClassName (
            [in] LPCWSTR className );

        [propput] HRESULT ImageName (
            [in] LPCWSTR imageName );

        [propput] HRESULT AllowSubstringMatch (
            [in] BOOL allowSubstringMatch );

        [propput] HRESULT CanCheckBaseClass (
            [in] BOOL canCheckBaseClass );

        [propput] HRESULT NeedsAdviseEvents (
            [in] BOOL adviseEvents );

        HRESULT SetWinEventsForAutomationEvent (
            [in] EVENTID eventId,
            [in] PROPERTYID propertyId,
            [in] SAFEARRAY(UINT) winEvents );

        HRESULT GetWinEventsForAutomationEvent (
            [in] EVENTID eventId,
            [in] PROPERTYID propertyId,
            [out, retval] SAFEARRAY(UINT) * winEvents );
    }

    //
    //  IUIAutomationProxyFactoryMapping
    //
    [object, uuid(09e31e18-872d-4873-93d1-1e541ec133fd), pointer_default(unique)]
    interface IUIAutomationProxyFactoryMapping : IUnknown
    {
        [propget] HRESULT Count (
            [out, retval] UINT *count );

        HRESULT GetTable ( 
            [out, retval] SAFEARRAY (IUIAutomationProxyFactoryEntry) * table );

        HRESULT GetEntry (
            [in] UINT index,
            [out, retval] IUIAutomationProxyFactoryEntry **entry );

        HRESULT SetTable (
            [in] SAFEARRAY (IUIAutomationProxyFactoryEntry) factoryList );

        HRESULT InsertEntries (
            [in] UINT before,
            [in] SAFEARRAY (IUIAutomationProxyFactoryEntry) factoryList );

        HRESULT InsertEntry (
            [in] UINT before,
            [in] IUIAutomationProxyFactoryEntry *factory );

        HRESULT RemoveEntry (
            [in] UINT index );

        HRESULT ClearTable ( );

        HRESULT RestoreDefaultTable ( );
    }

    //
    //  IUIAutomation
    //
    [object, uuid(30cbe57d-d9d0-452a-ab13-7ac5ac4825ee), pointer_default(unique)]
    interface IUIAutomation : IUnknown
    {
        // Comparisons
        HRESULT CompareElements (
            [in] IUIAutomationElement * el1,
            [in] IUIAutomationElement * el2,
            [out, retval] BOOL * areSame );

        HRESULT CompareRuntimeIds (
            [in] SAFEARRAY(int) runtimeId1,
            [in] SAFEARRAY(int) runtimeId2,
            [out, retval] BOOL * areSame);

        // Automation Element fetching
        HRESULT GetRootElement (
            [out, retval] IUIAutomationElement ** root );

        HRESULT ElementFromHandle (
            [in] UIA_HWND hwnd,
            [out, retval] IUIAutomationElement ** element );

        HRESULT ElementFromPoint (
            [in] POINT pt,
            [out, retval] IUIAutomationElement ** element );

        HRESULT GetFocusedElement (
            [out, retval] IUIAutomationElement ** element );

        HRESULT GetRootElementBuildCache (
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** root );

        HRESULT ElementFromHandleBuildCache (
            [in] UIA_HWND hwnd,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** element );

        HRESULT ElementFromPointBuildCache (
            [in] POINT pt,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** element );

        HRESULT GetFocusedElementBuildCache (
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** element );

        // Tree Walker Creation
        HRESULT CreateTreeWalker (
            [in] IUIAutomationCondition * pCondition,
            [out, retval] IUIAutomationTreeWalker ** walker );

        [propget] HRESULT ControlViewWalker (
            [out, retval] IUIAutomationTreeWalker ** walker );

        [propget] HRESULT ContentViewWalker (
            [out, retval] IUIAutomationTreeWalker ** walker );

        [propget] HRESULT RawViewWalker (
            [out, retval] IUIAutomationTreeWalker ** walker );

        [propget] HRESULT RawViewCondition (
            [out, retval] IUIAutomationCondition ** condition );

        [propget] HRESULT ControlViewCondition (
            [out, retval] IUIAutomationCondition ** condition );

        [propget] HRESULT ContentViewCondition (
            [out, retval] IUIAutomationCondition ** condition );


        // Cache Request Creation
        HRESULT CreateCacheRequest (
            [out, retval] IUIAutomationCacheRequest ** cacheRequest );


        // Condition Creation
        HRESULT CreateTrueCondition (
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreateFalseCondition (
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreatePropertyCondition (
            [in] PROPERTYID propertyId,
            [in] VARIANT value,
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreatePropertyConditionEx (
            [in] PROPERTYID propertyId,
            [in] VARIANT value,
            [in] enum PropertyConditionFlags flags,
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreateAndCondition (
            [in] IUIAutomationCondition * condition1,
            [in] IUIAutomationCondition * condition2,
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreateAndConditionFromArray (
            [in] SAFEARRAY(IUIAutomationCondition) conditions,
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreateAndConditionFromNativeArray (
            [in, size_is(conditionCount)] IUIAutomationCondition ** conditions,
            [in] int conditionCount,
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreateOrCondition (
            [in] IUIAutomationCondition * condition1,
            [in] IUIAutomationCondition * condition2,
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreateOrConditionFromArray (
            [in] SAFEARRAY(IUIAutomationCondition) conditions,
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreateOrConditionFromNativeArray (
            [in, size_is(conditionCount)] IUIAutomationCondition ** conditions,
            [in] int conditionCount,
            [out, retval] IUIAutomationCondition ** newCondition );

        HRESULT CreateNotCondition (
            [in] IUIAutomationCondition * condition,
            [out, retval] IUIAutomationCondition ** newCondition );

        // Event Registration and Removal
        HRESULT AddAutomationEventHandler (
            [in] EVENTID eventId,
            [in] IUIAutomationElement * element,
            [in] enum TreeScope scope,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [in] IUIAutomationEventHandler * handler );

        HRESULT RemoveAutomationEventHandler (
            [in] EVENTID eventId,
            [in] IUIAutomationElement * element,
            [in] IUIAutomationEventHandler * handler );

        HRESULT AddPropertyChangedEventHandlerNativeArray (
            [in] IUIAutomationElement * element,
            [in] enum TreeScope scope,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [in] IUIAutomationPropertyChangedEventHandler * handler,
            [in, size_is(propertyCount)] PROPERTYID * propertyArray,
            [in] int propertyCount );

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

        HRESULT RemovePropertyChangedEventHandler (
            [in] IUIAutomationElement * element,
            [in] IUIAutomationPropertyChangedEventHandler * handler );

        HRESULT AddStructureChangedEventHandler (
            [in] IUIAutomationElement * element,
            [in] enum TreeScope scope,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [in] IUIAutomationStructureChangedEventHandler * handler );

        HRESULT RemoveStructureChangedEventHandler (
            [in] IUIAutomationElement * element,
            [in] IUIAutomationStructureChangedEventHandler * handler );

        HRESULT AddFocusChangedEventHandler (
            [in] IUIAutomationCacheRequest * cacheRequest,
            [in] IUIAutomationFocusChangedEventHandler * handler );

        HRESULT RemoveFocusChangedEventHandler (
            [in] IUIAutomationFocusChangedEventHandler * handler );

        HRESULT RemoveAllEventHandlers ( );

        // Conversion helpers
        HRESULT IntNativeArrayToSafeArray (
            [in, size_is(arrayCount)] int * array,
            [in] int arrayCount,
            [out, retval] SAFEARRAY(int) * safeArray );

        HRESULT IntSafeArrayToNativeArray (
            [in] SAFEARRAY(int) intArray,
            [out, size_is( ,*arrayCount)] int ** array,
            [out, retval] int * arrayCount );

        HRESULT RectToVariant (
            [in] RECT rc,
            [out, retval] VARIANT * var );

        HRESULT VariantToRect (
            [in] VARIANT var,
            [out, retval] RECT * rc );

        HRESULT SafeArrayToRectNativeArray (
            [in] SAFEARRAY(double) rects,
            [out, size_is( ,*rectArrayCount)] RECT ** rectArray,
            [out, retval] int * rectArrayCount );

        // Proxy registration
        HRESULT CreateProxyFactoryEntry(
            [in] IUIAutomationProxyFactory *factory,
            [out, retval] IUIAutomationProxyFactoryEntry **factoryEntry );

        [propget] HRESULT ProxyFactoryMapping(
            [out, retval] IUIAutomationProxyFactoryMapping **factoryMapping );

        // Name Lookup
        HRESULT GetPropertyProgrammaticName(
            [in] PROPERTYID property,
            [out, retval] BSTR * name );

        HRESULT GetPatternProgrammaticName(
            [in] PATTERNID pattern,
            [out, retval] BSTR * name );
    
        // Return potentially supported patterns. Note that object may not actually
        // support the pattern when asked for it later.
        HRESULT PollForPotentialSupportedPatterns(
            [in] IUIAutomationElement * pElement,
            [out] SAFEARRAY(int) * patternIds,
            [out] SAFEARRAY(BSTR) * patternNames);

        // Return potentially supported properties. Note that object may not actually
        // support all properties when asked.
        HRESULT PollForPotentialSupportedProperties(
            [in] IUIAutomationElement * pElement,
            [out] SAFEARRAY(int) * propertyIds,
            [out] SAFEARRAY(BSTR) * propertyNames);

        // Check whether this variant (returned from GetPropertyValue) is the NotSupported item.
        HRESULT CheckNotSupported(
            [in] VARIANT value,
            [out, retval] BOOL * isNotSupported);

        // Get the "Not Supported" object
        [propget] HRESULT ReservedNotSupportedValue(
            [out, retval] IUnknown **notSupportedValue);

        // Get the "Mixed Attribute" object
        [propget] HRESULT ReservedMixedAttributeValue(
            [out, retval] IUnknown **mixedAttributeValue);

        // IAccessible interop
        HRESULT ElementFromIAccessible (
            [in] IAccessible * accessible,
            [in] int childId,
            [out, retval] IUIAutomationElement ** element );

        HRESULT ElementFromIAccessibleBuildCache (
            [in] IAccessible * accessible,
            [in] int childId,
            [in] IUIAutomationCacheRequest * cacheRequest,
            [out, retval] IUIAutomationElement ** element );
    }

    //
    //  CUIAutomation
    //
    [
        uuid(ff48dba4-60ef-4201-aa87-54103eef594e),
        version(1.0), 
        helpstring("The Central Class for UIAutomation")
    ]
    coclass CUIAutomation
    {
        [default] interface IUIAutomation;
    }

}

