File: Windows.Win32.IOleCommandTarget.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 System.Ole
	{
		[Guid("B722BCCB-4E68-101B-A2BC-00AA00404770")]
		[SupportedOSPlatform("windows5.0")]
		[global::System.CodeDom.Compiler.GeneratedCode("Microsoft.Windows.CsWin32", "0.3.151+58e949951d.RR")]
		internal unsafe partial struct IOleCommandTarget
			:IVTable<IOleCommandTarget,IOleCommandTarget.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]<IOleCommandTarget*,global::System.Guid* ,void** ,winmdroot.Foundation.HRESULT>)lpVtbl[0])((IOleCommandTarget*)Unsafe.AsPointer(ref this), riid, ppvObject);
			}

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

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

			/// <inheritdoc cref="QueryStatus(global::System.Guid*, uint, winmdroot.System.Ole.OLECMD*, winmdroot.System.Ole.OLECMDTEXT*)"/>
			internal unsafe winmdroot.Foundation.HRESULT QueryStatus(in global::System.Guid pguidCmdGroup, uint cCmds, ref winmdroot.System.Ole.OLECMD prgCmds, winmdroot.System.Ole.OLECMDTEXT* pCmdText)
			{
				fixed (winmdroot.System.Ole.OLECMD* prgCmdsLocal = &prgCmds)
				{
					fixed (global::System.Guid* pguidCmdGroupLocal = &pguidCmdGroup)
					{
						winmdroot.Foundation.HRESULT __result = this.QueryStatus(pguidCmdGroupLocal, cCmds, prgCmdsLocal, pCmdText);
						return __result;
					}
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT QueryStatus(IOleCommandTarget* pThis, global::System.Guid* pguidCmdGroup, uint cCmds, winmdroot.System.Ole.OLECMD* prgCmds, winmdroot.System.Ole.OLECMDTEXT* pCmdText)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.QueryStatus(pguidCmdGroup, cCmds, prgCmds, pCmdText);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Queries the object for the status of one or more commands generated by user interface events.</summary>
			/// <param name="pguidCmdGroup">The unique identifier of the command group; can be <b>NULL</b> to specify the standard group. All the commands that are passed in the <i>prgCmds</i> array must belong to the group specified by <i>pguidCmdGroup</i>.</param>
			/// <param name="cCmds">The number of commands in the <i>prgCmds</i> array.</param>
			/// <param name="prgCmds">A caller-allocated array of <a href="https://docs.microsoft.com/windows/desktop/api/docobj/ns-docobj-olecmd">OLECMD</a> structures that indicate the commands for which the caller needs status information. This method fills the <b>cmdf</b> member of each structure with values taken from the <a href="https://docs.microsoft.com/windows/desktop/api/docobj/ne-docobj-olecmdf">OLECMDF</a> enumeration.</param>
			/// <param name="pCmdText">A pointer to an <a href="https://docs.microsoft.com/windows/desktop/api/docobj/ns-docobj-olecmdtext">OLECMDTEXT</a> structure in which to return name and/or status information of a single command. This parameter can be <b>NULL</b> to indicate that the caller does not need this information.</param>
			/// <returns>
			/// <para>This method returns S_OK on success. Other possible return values include the following. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>Callers use <b>QueryStatus</b> to determine which commands are supported by a target object. The caller can then disable unavailable commands that would otherwise be routed to the object. The caller can also use this method to get the name or status of a single command.</remarks>
			public unsafe winmdroot.Foundation.HRESULT QueryStatus(global::System.Guid* pguidCmdGroup, uint cCmds, winmdroot.System.Ole.OLECMD* prgCmds, winmdroot.System.Ole.OLECMDTEXT* pCmdText)
			{
				return ((delegate *unmanaged [Stdcall]<IOleCommandTarget*,global::System.Guid* ,uint ,winmdroot.System.Ole.OLECMD* ,winmdroot.System.Ole.OLECMDTEXT* ,winmdroot.Foundation.HRESULT>)lpVtbl[3])((IOleCommandTarget*)Unsafe.AsPointer(ref this), pguidCmdGroup, cCmds, prgCmds, pCmdText);
			}

			/// <inheritdoc cref="Exec(global::System.Guid*, uint, uint, winmdroot.System.Variant.VARIANT*, winmdroot.System.Variant.VARIANT*)"/>
			internal unsafe winmdroot.Foundation.HRESULT Exec(in global::System.Guid pguidCmdGroup, uint nCmdID, uint nCmdexecopt, in winmdroot.System.Variant.VARIANT pvaIn, ref winmdroot.System.Variant.VARIANT pvaOut)
			{
				fixed (winmdroot.System.Variant.VARIANT* pvaOutLocal = &pvaOut)
				{
					fixed (winmdroot.System.Variant.VARIANT* pvaInLocal = &pvaIn)
					{
						fixed (global::System.Guid* pguidCmdGroupLocal = &pguidCmdGroup)
						{
							winmdroot.Foundation.HRESULT __result = this.Exec(pguidCmdGroupLocal, nCmdID, nCmdexecopt, pvaInLocal, pvaOutLocal);
							return __result;
						}
					}
				}
			}

			[UnmanagedCallersOnly(CallConvs = new []{
typeof(CallConvStdcall)}
)]
			private static winmdroot.Foundation.HRESULT Exec(IOleCommandTarget* pThis, global::System.Guid* pguidCmdGroup, uint nCmdID, uint nCmdexecopt, winmdroot.System.Variant.VARIANT* pvaIn, winmdroot.System.Variant.VARIANT* pvaOut)
			{
				try
				{
					winmdroot.Foundation.HRESULT __hr = ComHelpers.UnwrapCCW(pThis, out Interface __object);
					if (__hr.Failed)
					{
						return __hr;
					}
					return __object.Exec(pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
				}
				catch (Exception ex)
				{
					return (winmdroot.Foundation.HRESULT)ex.HResult;
				}
			}

			/// <summary>Executes the specified command or displays help for the command.</summary>
			/// <param name="pguidCmdGroup">The unique identifier of the command group; can be <b>NULL</b> to specify the standard group.</param>
			/// <param name="nCmdID">The command to be executed. This command must belong to the group specified with <i>pguidCmdGroup</i>.</param>
			/// <param name="nCmdexecopt">Specifies how the object should execute the command. Possible values are taken from the <a href="https://docs.microsoft.com/windows/desktop/api/docobj/ne-docobj-olecmdexecopt">OLECMDEXECOPT</a> and <a href="https://docs.microsoft.com/windows/desktop/api/docobj/ne-docobj-olecmdid_windowstate_flag">OLECMDID_WINDOWSTATE_FLAG</a> enumerations.</param>
			/// <param name="pvaIn">A pointer to a <a href="https://docs.microsoft.com/windows/win32/api/oaidl/ns-oaidl-variant">VARIANTARG</a> structure containing input arguments. This parameter can be <b>NULL</b>.</param>
			/// <param name="pvaOut">Pointer to a VARIANTARG structure to receive command output. This parameter can be <b>NULL</b>.</param>
			/// <returns>
			/// <para>This method returns S_OK on success. Other possible return values include the following. </para>
			/// <para>This doc was truncated.</para>
			/// </returns>
			/// <remarks>
			/// <para>The list of input and output arguments of a command and how they are packaged is unique to each command. Such information should be documented with the specification of the command group. (See the description of OLECMDID_ZOOM in the <a href="https://docs.microsoft.com/windows/desktop/api/docobj/ne-docobj-olecmdid">OLECMDID</a> enumeration.) In the absence of any specific information the command is assumed to take no arguments and have no return value. <h3><a id="Notes_to_Callers"></a><a id="notes_to_callers"></a><a id="NOTES_TO_CALLERS"></a>Notes to Callers</h3> The <i>pguidCmdGroup</i> and <i>nCmdID</i> parameters together uniquely identify the command to invoke. The <i>nCmdExecOpt</i> parameter specifies the exact action to be taken. (See the <a href="https://docs.microsoft.com/windows/desktop/api/docobj/ne-docobj-olecmdexecopt">OLECMDEXECOPT</a> enumeration for more details.) Most commands neither take arguments nor return values. For such commands, the caller can pass <b>NULL</b> in <i>pvaIn</i> and <i>pvaOut</i>. For commands that expect one or more input values, the caller can declare and initialize a VARIANTARG variable and pass a pointer to that variable in pvaIn. If the input to the command is a single value, the argument can be stored directly in the VARIANTARG structure and passed to the function. If the command expects multiple arguments, those arguments must be packaged appropriately within the VARIANTARG, using one of the supported types (such as <b>IDispatch</b> or <b>SAFEARRAY</b>). If a command returns one or more arguments, the caller is expected to declare a VARIANTARG, initialize it to VT_EMPTY, and pass its address in pvaOut. If the command returns a single value, then the object can store that value directly in pvaOut. If the command has multiple output values, then it will package those in some way appropriate for the VARIANTARG. Because <i>pvaIn</i> and <i>pvOut</i> are both caller-allocated, stack variables are permitted for both the caller and the object receiving the call. For commands that take zero or one argument on input and return zero or one value, no additional memory allocation is necessary. Most of the types supported by VARIANTARG do not require memory allocation. Exceptions include <b>SAFEARRAY</b> and <b>BSTR</b>. <h3><a id="Notes_to_Implementers"></a><a id="notes_to_implementers"></a><a id="NOTES_TO_IMPLEMENTERS"></a>Notes to Implementers</h3> A command target must implement this function; E_NOTIMPL is not a valid return value.</para>
			/// <para><see href="https://learn.microsoft.com/windows/win32/api/docobj/nf-docobj-iolecommandtarget-exec#">Read more on docs.microsoft.com</see>.</para>
			/// </remarks>
			public unsafe winmdroot.Foundation.HRESULT Exec(global::System.Guid* pguidCmdGroup, uint nCmdID, uint nCmdexecopt, winmdroot.System.Variant.VARIANT* pvaIn, winmdroot.System.Variant.VARIANT* pvaOut)
			{
				return ((delegate *unmanaged [Stdcall]<IOleCommandTarget*,global::System.Guid* ,uint ,uint ,winmdroot.System.Variant.VARIANT* ,winmdroot.System.Variant.VARIANT* ,winmdroot.Foundation.HRESULT>)lpVtbl[4])((IOleCommandTarget*)Unsafe.AsPointer(ref this), pguidCmdGroup, nCmdID, nCmdexecopt, pvaIn, pvaOut);
			}

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

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

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

				internal delegate *unmanaged [Stdcall]<IOleCommandTarget*,global::System.Guid* ,uint ,winmdroot.System.Ole.OLECMD* ,winmdroot.System.Ole.OLECMDTEXT* ,winmdroot.Foundation.HRESULT> QueryStatus_4;

				internal delegate *unmanaged [Stdcall]<IOleCommandTarget*,global::System.Guid* ,uint ,uint ,winmdroot.System.Variant.VARIANT* ,winmdroot.System.Variant.VARIANT* ,winmdroot.Foundation.HRESULT> Exec_5;
			} 
			public static void PopulateVTable(Vtbl* vtable)
			{
				vtable->QueryStatus_4 = &QueryStatus;
				vtable->Exec_5 = &Exec;
			}

			private void** lpVtbl;

			/// <summary>The IID guid for this interface.</summary>
			/// <value>{b722bccb-4e68-101b-a2bc-00aa00404770}</value>
			internal static readonly Guid IID_Guid = new Guid(0xB722BCCB, 0x4E68, 0x101B, 0xA2, 0xBC, 0x00, 0xAA, 0x00, 0x40, 0x47, 0x70);

			static ref readonly Guid IComIID.Guid			{
								[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
				{
					ReadOnlySpan<byte> data = new byte[]					{
0xCB,0xBC,0x22,0xB7,0x68,0x4E,0x1B,0x10,0xA2,0xBC,0x00,0xAA,0x00,0x40,0x47,0x70					};
					return ref Unsafe.As<byte,Guid>(ref MemoryMarshal.GetReference(data));
				}
			}
			[Guid("B722BCCB-4E68-101B-A2BC-00AA00404770"),InterfaceType(ComInterfaceType.InterfaceIsIUnknown),ComImport()]
			[SupportedOSPlatform("windows5.0")]
			internal interface Interface
			{
				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT QueryStatus(global::System.Guid* pguidCmdGroup, uint cCmds, winmdroot.System.Ole.OLECMD* prgCmds, winmdroot.System.Ole.OLECMDTEXT* pCmdText);

				[PreserveSig()]
				unsafe winmdroot.Foundation.HRESULT Exec(global::System.Guid* pguidCmdGroup, uint nCmdID, uint nCmdexecopt, winmdroot.System.Variant.VARIANT* pvaIn, winmdroot.System.Variant.VARIANT* pvaOut);
			}
		}
	}
}