IVsCommandWindow.ExecuteCommand Method

Executes the specified command.

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

Syntax

'Declaration
Function ExecuteCommand ( _
    szCommand As String _
) As Integer
int ExecuteCommand(
    string szCommand
)
int ExecuteCommand(
    [InAttribute] String^ szCommand
)
abstract ExecuteCommand : 
        szCommand:string -> int 
function ExecuteCommand(
    szCommand : String
) : int

Parameters

  • szCommand
    Type: System.String
    [in] String containing the command.

Return Value

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

Remarks

If the command is invalid or disabled the method reports the error to the user and returns S_OK.

Note that the method returns control to the caller before the command has actually executed: ExecuteCommand simply posts a Windows message. When the shell receives the message, it executes the command.

COM Signature

From vsshell.idl:

HRESULT IVsCommandWindow::ExecuteCommand(
   [in, ref] LPCOLESTR szCommand
);

.NET Framework Security

See Also

Reference

IVsCommandWindow Interface

Microsoft.VisualStudio.Shell.Interop Namespace