File: Windows.Win32.IUIAutomationFocusChangedEventHandler.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("C270F6B5-5C69-4290-9745-7A7F97169468")]
		[SupportedOSPlatform("windows6.1")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IUIAutomationFocusChangedEventHandler
			:IVTable<IUIAutomationFocusChangedEventHandler,IUIAutomationFocusChangedEventHandler.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]<IUIAutomationFocusChangedEventHandler*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IUIAutomationFocusChangedEventHandler*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

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

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

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

			/// <summary>Handles the event raised when the keyboard focus moves to a different UI Automation element.</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 has received the focus.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/uiautomationclient/nf-uiautomationclient-iuiautomationfocuschangedeventhandler-handlefocuschangedevent#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 were subscribed to by using <a href="https://docs.microsoft.com/windows/desktop/api/uiautomationclient/nf-uiautomationclient-iuiautomation-addfocuschangedeventhandler">AddFocusChangedEventHandler</a></para>
			/// <para>The UI Automation element represented by <i>sender</i> might not have any cached properties or control patterns, depending on whether the application subscribed to this event while a cache request was active. 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-iuiautomationfocuschangedeventhandler-handlefocuschangedevent#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe void HandleFocusChangedEvent(winmdroot.UI.Accessibility.IUIAutomationElement* sender)
			{
				((delegate *unmanaged [Stdcall]<IUIAutomationFocusChangedEventHandler*,winmdroot.UI.Accessibility.IUIAutomationElement* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IUIAutomationFocusChangedEventHandler*)Unsafe.AsPointer(ref this), sender).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]<IUIAutomationFocusChangedEventHandler*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT> QueryInterface_1;

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

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

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

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{c270f6b5-5c69-4290-9745-7a7f97169468}</value>
			internal static readonly Guid IID_Guid = new Guid(0xC270F6B5, 0x5C69, 0x4290, 0x97, 0x45, 0x7A, 0x7F, 0x97, 0x16, 0x94, 0x68);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0xB5,0xF6,0x70,0xC2,0x69,0x5C,0x90,0x42,0x97,0x45,0x7A,0x7F,0x97,0x16,0x94,0x68					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("C270F6B5-5C69-4290-9745-7A7F97169468"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows6.1")]
			internal interface Interface
			{
				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT HandleFocusChangedEvent(winmdroot.UI.Accessibility.IUIAutomationElement* sender);
			}
		}
	}
}