共用方式為


OleMenuCommandService.IOleCommandTarget.Exec Method

This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.

Executes the selected command.

Namespace:  Microsoft.VisualStudio.Shell
Assembly:  Microsoft.VisualStudio.Shell.11.0 (in Microsoft.VisualStudio.Shell.11.0.dll)

Syntax

'宣告
Private Function Exec ( _
    ByRef guidGroup As Guid, _
    nCmdId As UInteger, _
    nCmdExcept As UInteger, _
    pIn As IntPtr, _
    vOut As IntPtr _
) As Integer Implements IOleCommandTarget.Exec
int IOleCommandTarget.Exec(
    ref Guid guidGroup,
    uint nCmdId,
    uint nCmdExcept,
    IntPtr pIn,
    IntPtr vOut
)

Parameters

  • guidGroup
    Type: System.Guid%
    The menu group. This implementation maps the group to CommandID.Guid.
  • nCmdId
    Type: System.UInt32
    The ID code of the command. This implementation maps nCmdId to CommandID.ID.
  • nCmdExcept
    Type: System.UInt32
    The number of command options. This implementation ignores this parameter.
  • pIn
    Type: System.IntPtr
    The actual command options. This implementation ignores this parameter.
  • vOut
    Type: System.IntPtr
    Output data for the command. This implementation ignores this parameter.

Return Value

Type: System.Int32
An HRESULT code indicating the success or failure of the call. The following HRESULTs may be returned:

Value

Description

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

IOleCommandTarget.Exec(Guid%, UInt32, UInt32, IntPtr, IntPtr)

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.

.NET Framework Security

See Also

Reference

OleMenuCommandService Class

Microsoft.VisualStudio.Shell Namespace