Permalink
Fetching contributors…
Cannot retrieve contributors at this time
70 lines (66 sloc) 3.99 KB
#region Usings
using System;
using System.Runtime.InteropServices;
#endregion
namespace Dapplo.Windows.Com
{
/// <summary>
/// Enables objects and their containers to dispatch commands to each other. For example, an object's toolbars may contain buttons for commands such as Print, Print Preview, Save, New, and Zoom.
/// <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms683797(v=vs.85).aspx">IOleCommandTarget interface</a>
/// </summary>
[ComImport]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
[ComVisible(true)]
[Guid("B722BCCB-4E68-101B-A2BC-00AA00404770")]
public interface IOleCommandTarget
{
/// <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 NULL to specify the standard group.</param>
/// <param name="cCmds">The number of commands in the prgCmds array.</param>
/// <param name="prgCmds">A caller-allocated array of OLECMD structures that indicate the commands for which the caller needs status information. This method fills the cmdf member of each structure with values taken from the OLECMDF enumeration.</param>
/// <param name="pCmdText">A pointer to an OLECMDTEXT structure in which to return name and/or status information of a single command. This parameter can be NULL to indicate that the caller does not need this information.</param>
/// <returns>
/// This method returns S_OK on success. Other possible return values include the following.
/// E_FAIL
/// The operation failed.
///
/// E_UNEXPECTED
/// An unexpected error has occurred.
///
/// E_POINTER
/// The prgCmds argument is NULL.
///
/// OLECMDERR_E_UNKNOWNGROUP
/// The pguidCmdGroup parameter is not NULL but does not specify a recognized command group.
/// </returns>
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int QueryStatus([In] [MarshalAs(UnmanagedType.LPStruct)] Guid pguidCmdGroup, int cCmds, IntPtr prgCmds, IntPtr pCmdText);
/// <summary>
/// Executes the specified command or displays help for the command.
/// </summary>
/// <param name="pguidCmdGroup">The unique identifier of the command group; can be NULL to specify the standard group.</param>
/// <param name="nCmdId">The command to be executed. This command must belong to the group specified with pguidCmdGroup.</param>
/// <param name="nCmdexecopt">Specifies how the object should execute the command. Possible values are taken from the OLECMDEXECOPT and OLECMDID_WINDOWSTATE_FLAG enumerations.</param>
/// <param name="pvaIn">A pointer to a VARIANTARG structure containing input arguments. This parameter can be NULL.</param>
/// <param name="pvaOut">Pointer to a VARIANTARG structure to receive command output. This parameter can be NULL.</param>
/// <returns>
/// This method returns S_OK on success. Other possible return values include the following.
/// OLECMDERR_E_UNKNOWNGROUP
/// The pguidCmdGroup parameter is not NULL but does not specify a recognized command group.
/// OLECMDERR_E_NOTSUPPORTED
/// The nCmdID parameter is not a valid command in the group identified by pguidCmdGroup.
/// OLECMDERR_E_DISABLED
/// The command identified by nCmdID is currently disabled and cannot be executed.
/// OLECMDERR_E_NOHELP
/// The caller has asked for help on the command identified by nCmdID, but no help is available.
/// OLECMDERR_E_CANCELED
/// The user canceled the execution of the command.
/// </returns>
[return: MarshalAs(UnmanagedType.I4)]
[PreserveSig]
int Exec([In] [MarshalAs(UnmanagedType.LPStruct)] Guid pguidCmdGroup, int nCmdId, int nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut);
}
}