Share via


ExpansionProvider.HandlePreExec Method

Called before a command is executed.

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.9.0 (in Microsoft.VisualStudio.Package.LanguageService.9.0.dll)
  Microsoft.VisualStudio.Package.LanguageService.11.0 (in Microsoft.VisualStudio.Package.LanguageService.11.0.dll)

Syntax

'Declaration
Public Overridable Function HandlePreExec ( _
    ByRef guidCmdGroup As Guid, _
    nCmdId As UInteger, _
    nCmdexecopt As UInteger, _
    pvaIn As IntPtr, _
    pvaOut As IntPtr _
) As Boolean
public virtual bool HandlePreExec(
    ref Guid guidCmdGroup,
    uint nCmdId,
    uint nCmdexecopt,
    IntPtr pvaIn,
    IntPtr pvaOut
)
public:
virtual bool HandlePreExec(
    Guid% guidCmdGroup, 
    unsigned int nCmdId, 
    unsigned int nCmdexecopt, 
    IntPtr pvaIn, 
    IntPtr pvaOut
)
abstract HandlePreExec : 
        guidCmdGroup:Guid byref * 
        nCmdId:uint32 * 
        nCmdexecopt:uint32 * 
        pvaIn:IntPtr * 
        pvaOut:IntPtr -> bool  
override HandlePreExec : 
        guidCmdGroup:Guid byref * 
        nCmdId:uint32 * 
        nCmdexecopt:uint32 * 
        pvaIn:IntPtr * 
        pvaOut:IntPtr -> bool
public function HandlePreExec(
    guidCmdGroup : Guid, 
    nCmdId : uint, 
    nCmdexecopt : uint, 
    pvaIn : IntPtr, 
    pvaOut : IntPtr
) : boolean

Parameters

  • guidCmdGroup
    Type: System.Guid%

    [in] The GUID of the command group.

  • nCmdId
    Type: System.UInt32

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

  • nCmdexecopt
    Type: System.UInt32

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

  • pvaIn
    Type: System.IntPtr

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

  • pvaOut
    Type: System.IntPtr

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

Return Value

Type: System.Boolean
If the command was handled, returns true; otherwise, returns false to let the caller handle the command.

Remarks

This method is called before a command is executed. For an expansion provider, this provides the opportunity to interact with an expansion session.

The base method does nothing if an expansion session has not been started or there is an IntelliSense completer list box active. Otherwise, this method handles the following key commands.

Command

Description

CANCEL

Ends the snippet session by calling the EndTemplateEditing method, leaving the caret where the template put it.

RETURN

If a completer list box is not active, ends the snippet session by calling the EndTemplateEditing method, leaving the caret where the user put it.

BACKTAB

Moves focus to the previous field by calling the GoToPreviousExpansionField method on the IVsExpansionSession object.

TAB

Moves focus to the next field by calling the GoToNextExpansionField method on the IVsExpansionSession object.

.NET Framework Security

See Also

Reference

ExpansionProvider Class

Microsoft.VisualStudio.Package Namespace