File: Windows.Win32.IUIAutomationElementArray.g.cs
Project: src\src\System.Windows.Forms.Primitives\src\System.Windows.Forms.Primitives.csproj (System.Windows.Forms.Primitives)
// ------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

#pragma warning disable CS1591,CS1573,CS0465,CS0649,CS8019,CS1570,CS1584,CS1658,CS0436,CS8981
using global::System;
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;
using global::System.Runtime.CompilerServices;
using global::System.Runtime.InteropServices;
using global::System.Runtime.Versioning;
using winmdroot = global::Windows.Win32;
namespace Windows.Win32
{
	namespace UI.Accessibility
	{
		[Guid("14314595-B4BC-4055-95F2-58F2E42C9855")]
		[SupportedOSPlatform("windows6.1")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IUIAutomationElementArray
			:IVTable<IUIAutomationElementArray,IUIAutomationElementArray.Vtbl>,IComIID		{
			/// <inheritdoc cref="QueryInterface(global::System.Guid*, void**)"/>
			internal unsafe winmdroot.Foundation.HRESULT QueryInterface(in global::System.Guid riid, out void* ppvObject)
			{
				fixed (void** ppvObjectLocal = &ppvObject)
				{
					fixed (global::System.Guid* riidLocal = &riid)
					{
						winmdroot.Foundation.HRESULT __result = this.QueryInterface(riidLocal, ppvObjectLocal);
						return __result;
					}
				}
			}

			public unsafe winmdroot.Foundation.HRESULT QueryInterface(global::System.Guid* riid, void** ppvObject)
			{
				return ((delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IUIAutomationElementArray*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

			public uint AddRef()
			{
				return ((delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,uint>)lpVtbl[1])((IUIAutomationElementArray*)Unsafe.AsPointer(ref this));
			}

			public uint Release()
			{
				return ((delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,uint>)lpVtbl[2])((IUIAutomationElementArray*)Unsafe.AsPointer(ref this));
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT get_Length(IUIAutomationElementArray* pThis, int* length)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					*length = __object.Length;
					return winmdroot.Foundation.HRESULT.S_OK;
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves the number of elements in the collection. (IUIAutomationElementArray.get_Length)</summary>
			/// <remarks>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelementarray-get_length">Learn more about this API from docs.microsoft.com</see>.</para>
			/// </remarks>
			internal int Length
			{
				get
				{
					int __result;
					((delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,int* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IUIAutomationElementArray*)Unsafe.AsPointer(ref this), &__result).ThrowOnFailure();
					return __result;
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT GetElement(IUIAutomationElementArray* pThis, int index, winmdroot.UI.Accessibility.IUIAutomationElement** element)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.GetElement(index, element);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Retrieves a Microsoft UI Automation element from the collection.</summary>
			/// <param name="index">
			/// <para>Type: <b>int</b> The zero-based index of the element.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelementarray-getelement#parameters">Read more on docs.microsoft.com</see>.</para>
			/// </param>
			/// <returns>
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/WinProg/windows-data-types">HRESULT</a></b> If this method succeeds, it returns <b>S_OK</b>. Otherwise, it returns an <b>HRESULT</b> error code.</para>
			/// </returns>
			/// <remarks>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationelementarray-getelement">Learn more about this API from docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.UI.Accessibility.IUIAutomationElement* GetElement(int index)
			{
				winmdroot.UI.Accessibility.IUIAutomationElement* __retVal = default(winmdroot.UI.Accessibility.IUIAutomationElement*);
				((delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,int ,winmdroot.UI.Accessibility.IUIAutomationElement** ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IUIAutomationElementArray*)Unsafe.AsPointer(ref this), index, &__retVal).ThrowOnFailure();
				return __retVal;
			}

			internal unsafe global::Windows.Win32.Foundation.HRESULT QueryInterface<T>(out T* ppv)
where T : unmanaged

			{
				var hr = this.QueryInterface(typeof(T).GUID, out void* pv);
				if (hr.Succeeded)

				{
					ppv = (T*)pv;
				}
				else

				{
					ppv = null;
				}

				return hr;
			}

			internal struct Vtbl
			{
				internal delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;

				internal delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,uint> AddRef_2;

				internal delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,uint> Release_3;

				internal delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,int* ,winmdroot.Foundation.HRESULT> get_Length_4;

				internal delegate *unmanaged [Stdcall]<IUIAutomationElementArray*,int ,winmdroot.UI.Accessibility.IUIAutomationElement** ,winmdroot.Foundation.HRESULT> GetElement_5;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->get_Length_4 = &get_Length;
				vtable->GetElement_5 = &GetElement;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{14314595-b4bc-4055-95f2-58f2e42c9855}</value>
			internal static readonly Guid IID_Guid = new Guid(0x14314595, 0xB4BC, 0x4055, 0x95, 0xF2, 0x58, 0xF2, 0xE4, 0x2C, 0x98, 0x55);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0x95,0x45,0x31,0x14,0xBC,0xB4,0x55,0x40,0x95,0xF2,0x58,0xF2,0xE4,0x2C,0x98,0x55					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("14314595-B4BC-4055-95F2-58F2E42C9855"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows6.1")]
			internal interface Interface
			{
				int Length
				{
					get;
				}

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT GetElement(int index, winmdroot.UI.Accessibility.IUIAutomationElement** element);
			}
		}
	}
}