Partager via


OleMenuCommandService.IOleCommandTarget.Exec Method

Definition

Executes the selected command.

 virtual int Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec(Guid % commandGroup, System::UInt32 nCmdId, System::UInt32 nCmdExcept, IntPtr pIn, IntPtr vOut) = Microsoft::VisualStudio::OLE::Interop::IOleCommandTarget::Exec;
int IOleCommandTarget.Exec (ref Guid commandGroup, uint nCmdId, uint nCmdExcept, IntPtr pIn, IntPtr vOut);
abstract member Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec : Guid * uint32 * uint32 * nativeint * nativeint -> int
override this.Microsoft.VisualStudio.OLE.Interop.IOleCommandTarget.Exec : Guid * uint32 * uint32 * nativeint * nativeint -> int
Function Exec (ByRef commandGroup As Guid, nCmdId As UInteger, nCmdExcept As UInteger, pIn As IntPtr, vOut As IntPtr) As Integer Implements IOleCommandTarget.Exec

Parameters

commandGroup
Guid

The menu group. This implementation maps the group to CommandID.Guid.

nCmdId
UInt32

The ID code of the command. This implementation maps nCmdId to CommandID.ID.

nCmdExcept
UInt32

The number of command options. This implementation ignores this parameter.

pIn
IntPtr

nativeint

The actual command options. This implementation ignores this parameter.

vOut
IntPtr

nativeint

Output data for the command. This implementation ignores this parameter.

Returns

An HRESULT code indicating the success or failure of the call. The following HRESULTs may be returned:ValueDescription S_OK The command was successfully invoked. OLECMDERR_E_UNKNOWNGROUP The group GUID did not match the commandID’s Guid property for any command or verb. OLECMDERR_E_NOTSUPPORTED The group was found, but there is no command or verb with an ID that matches. This is also returned if the OleStatus property of a command that was found returns zero.

Implements

Remarks

This method is defined as a private interface implementation for IOleCommandTarget. To make use of it, a tool or document window generally implements IOleCommandTarget itself, and then forwards calls to the implementation contained in MenuCommandService. This implementation of Exec uses FindCommand to determine if a command exists, and invokes the command if it is disabled.

Applies to