다음을 통해 공유


ViewFilter.ExecCommand Method

Executes the specified command.

Namespace:  Microsoft.VisualStudio.Package
Assemblies:   Microsoft.VisualStudio.Package.LanguageService.10.0 (in Microsoft.VisualStudio.Package.LanguageService.10.0.dll)
  Microsoft.VisualStudio.Package.LanguageService (in Microsoft.VisualStudio.Package.LanguageService.dll)
  Microsoft.VisualStudio.Package.LanguageService.12.0 (in Microsoft.VisualStudio.Package.LanguageService.12.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)

Syntax

'Declaration
Protected Overridable Function ExecCommand ( _
    ByRef guidCmdGroup As Guid, _
    nCmdId As UInteger, _
    nCmdexecopt As UInteger, _
    pvaIn As IntPtr, _
    pvaOut As IntPtr _
) As Integer
protected virtual int ExecCommand(
    ref Guid guidCmdGroup,
    uint nCmdId,
    uint nCmdexecopt,
    IntPtr pvaIn,
    IntPtr pvaOut
)
protected:
virtual int ExecCommand(
    Guid% guidCmdGroup, 
    unsigned int nCmdId, 
    unsigned int nCmdexecopt, 
    IntPtr pvaIn, 
    IntPtr pvaOut
)
abstract ExecCommand : 
        guidCmdGroup:Guid byref * 
        nCmdId:uint32 * 
        nCmdexecopt:uint32 * 
        pvaIn:IntPtr * 
        pvaOut:IntPtr -> int  
override ExecCommand : 
        guidCmdGroup:Guid byref * 
        nCmdId:uint32 * 
        nCmdexecopt:uint32 * 
        pvaIn:IntPtr * 
        pvaOut:IntPtr -> int
protected function ExecCommand(
    guidCmdGroup : Guid, 
    nCmdId : uint, 
    nCmdexecopt : uint, 
    pvaIn : IntPtr, 
    pvaOut : IntPtr
) : int

Parameters

  • guidCmdGroup
    Type: Guid%

    [in] The GUID of the command group.

  • nCmdId
    Type: UInt32

    [in] The specific ID of the command from the command group. This identifies the command to execute.

  • nCmdexecopt
    Type: UInt32

    [in] Additional parameters for the command (packed into a 32-bit value).

  • pvaIn
    Type: IntPtr

    [in] An unmarshaled pointer to a Variant object holding any parameters required by the command. This can be a null value indicating there are no additional parameters.

  • pvaOut
    Type: IntPtr

    [in, out] An unmarshaled pointer to a Variant object to hold the result of the command, if any.

Return Value

Type: Int32
If successful, returns S_OK; otherwise, returns an error code.

Remarks

This method is called to execute a particular command. In general, this method should first call the HandlePreExec method, then some sort of execution method, and finally the HandlePostExec method. If the command is not handled by any of these, the command should be passed on to the next command target.

The base method first calls the IsExpansionUIActive method to determine if an expansion user interface (UI) is active. If so, the base method immediately passes the command on to the next command target and returns the result. Otherwise, the base method gets the ExpansionProvider object and, if that object exists, calls its HandlePreExec method. It the ExpansionProvider's HandlePreExec method indicates the command was handled, the base method returns immediately.

If neither the expansion UI nor the ExpansionProvider is active, the base method calls the HandlePreExec method. If HandlePreExec does not handle the command, the command is passed on to the next command target. The base method then calls the HandlePostExec method on the ExpansionProvider object (if it exists) before calling the HandlePostExec method.

The base method also handles the special case of an Enter key pressed while a completion set is open but nothing is selected in the set; in this case, the Enter key should be added to the source file and this is done by passing the command to the next command target a second time (the first time closes the completion set and consumes the Enter key).

This method is typically called from the base class's internal implementation of the Exec method on the IOleCommandTarget interface.

.NET Framework Security

See Also

Reference

ViewFilter Class

Microsoft.VisualStudio.Package Namespace