共用方式為


IVsUIShell.PostExecCommand Method

Allows asynchronous execution of commands.

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

Syntax

'宣告
Function PostExecCommand ( _
    ByRef pguidCmdGroup As Guid, _
    nCmdID As UInteger, _
    nCmdexecopt As UInteger, _
    ByRef pvaIn As Object _
) As Integer
'用途
Dim instance As IVsUIShell
Dim pguidCmdGroup As Guid
Dim nCmdID As UInteger
Dim nCmdexecopt As UInteger
Dim pvaIn As Object
Dim returnValue As Integer

returnValue = instance.PostExecCommand(pguidCmdGroup, _
    nCmdID, nCmdexecopt, pvaIn)
int PostExecCommand(
    ref Guid pguidCmdGroup,
    uint nCmdID,
    uint nCmdexecopt,
    ref Object pvaIn
)
int PostExecCommand(
    [InAttribute] Guid% pguidCmdGroup, 
    [InAttribute] unsigned int nCmdID, 
    [InAttribute] unsigned int nCmdexecopt, 
    [InAttribute] Object^% pvaIn
)
abstract PostExecCommand : 
        pguidCmdGroup:Guid byref * 
        nCmdID:uint32 * 
        nCmdexecopt:uint32 * 
        pvaIn:Object byref -> int 
function PostExecCommand(
    pguidCmdGroup : Guid, 
    nCmdID : uint, 
    nCmdexecopt : uint, 
    pvaIn : Object
) : int

Parameters

  • pguidCmdGroup
    Type: System.Guid%
    [in, unique] Unique identifier of the command group; can be nulla null reference (Nothing in Visual Basic) to specify the standard group. All the commands that are passed in the nCmdID must belong to the group specified by pguidCmdGroup.
  • nCmdID
    Type: System.UInt32
    [in] The command to be executed. This command must belong to the group specified with pguidCmdGroup.
  • nCmdexecopt
    Type: System.UInt32
    [in] Values describe how the object should execute the command.
  • pvaIn
    Type: System.Object%
    [in, unique] Pointer to a VARIANTARG structure containing input arguments. Can be nulla null reference (Nothing in Visual Basic).

Return Value

Type: System.Int32
If the method succeeds, it returns S_OK. If it fails, it returns an error code.

Remarks

COM Signature

From vsshell.idl:

HRESULT IVsUIShell::PostExecCommand(
   [in, unique] const GUID * pguidCmdGroup,
   [in] DWORD nCmdID,
   [in] DWORD nCmdexecopt,
   [in, unique] VARIANT * pvaIn
);

To synchronously execute a command, call QueryService for the SID_SUIHostCommandDispatcher service, which returns an object that implements IOleCommandTarget. In this case, the environment synchronously executes the command and return. Use IVsUIShell.PostExecCommand method to asynchronously execute a command. That is, the command is posted to the environment, but control is returned to you immediately. The command then executes at a later time.

.NET Framework Security

See Also

Reference

IVsUIShell Interface

IVsUIShell Members

Microsoft.VisualStudio.Shell.Interop Namespace