File: Windows.Win32.IUIAutomationEventHandler.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("146C3C17-F12E-4E22-8C27-F894B9B79C69")]
		[SupportedOSPlatform("windows6.1")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IUIAutomationEventHandler
			:IVTable<IUIAutomationEventHandler,IUIAutomationEventHandler.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]<IUIAutomationEventHandler*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IUIAutomationEventHandler*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

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

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

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT HandleAutomationEvent(IUIAutomationEventHandler* pThis, winmdroot.UI.Accessibility.IUIAutomationElement* sender, winmdroot.UI.Accessibility.UIA_EVENT_ID eventId)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.HandleAutomationEvent(sender, eventId);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Handles a Microsoft UI Automation event.</summary>
			/// <param name="sender">
			/// <para>Type: <b><a href="https://docs.microsoft.com/windows/desktop/api/uiautomationclient/nn-uiautomationclient-iuiautomationelement">IUIAutomationElement</a>*</b> A pointer to  the element that raised the event.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationeventhandler-handleautomationevent#parameters">Read more on docs.microsoft.com</see>.</para>
			/// </param>
			/// <param name="eventId">
			/// <para>Type: <b>EVENTID</b> The event identifier. For a list of event identifiers, see <a href="https://docs.microsoft.com/windows/desktop/WinAuto/uiauto-event-ids">Event Identifiers</a>.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationeventhandler-handleautomationevent#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>This method is implemented by the application to handle events that it has subscribed to by using <a href="https://docs.microsoft.com/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomation-addautomationeventhandler">AddAutomationEventHandler</a>.</para>
			/// <para>Adjusting an event handler from within this method is not supported.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationeventhandler-handleautomationevent#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe void HandleAutomationEvent(winmdroot.UI.Accessibility.IUIAutomationElement* sender, winmdroot.UI.Accessibility.UIA_EVENT_ID eventId)
			{
				((delegate *unmanaged [Stdcall]<IUIAutomationEventHandler*,winmdroot.UI.Accessibility.IUIAutomationElement* ,winmdroot.UI.Accessibility.UIA_EVENT_ID ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IUIAutomationEventHandler*)Unsafe.AsPointer(ref this), sender, eventId).ThrowOnFailure();
			}

			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]<IUIAutomationEventHandler*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;

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

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

				internal delegate *unmanaged [Stdcall]<IUIAutomationEventHandler*,winmdroot.UI.Accessibility.IUIAutomationElement* ,winmdroot.UI.Accessibility.UIA_EVENT_ID ,winmdroot.Foundation.HRESULT> HandleAutomationEvent_4;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->HandleAutomationEvent_4 = &HandleAutomationEvent;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{146c3c17-f12e-4e22-8c27-f894b9b79c69}</value>
			internal static readonly Guid IID_Guid = new Guid(0x146C3C17, 0xF12E, 0x4E22, 0x8C, 0x27, 0xF8, 0x94, 0xB9, 0xB7, 0x9C, 0x69);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0x17,0x3C,0x6C,0x14,0x2E,0xF1,0x22,0x4E,0x8C,0x27,0xF8,0x94,0xB9,0xB7,0x9C,0x69					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("146C3C17-F12E-4E22-8C27-F894B9B79C69"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows6.1")]
			internal interface Interface
			{
				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT HandleAutomationEvent(winmdroot.UI.Accessibility.IUIAutomationElement* sender, winmdroot.UI.Accessibility.UIA_EVENT_ID eventId);
			}
		}
	}
}