Executes the specified command.
Namespace:  Microsoft.VisualStudio.OLE.Interop
Assembly:  Microsoft.VisualStudio.OLE.Interop (in Microsoft.VisualStudio.OLE.Interop.dll)
Syntax
'Declaration
Function Exec ( _
    ByRef pguidCmdGroup As Guid, _
    nCmdID As UInteger, _
    nCmdexecopt As UInteger, _
    pvaIn As IntPtr, _
    pvaOut As IntPtr _
) As Integer
int Exec(
    ref Guid pguidCmdGroup,
    uint nCmdID,
    uint nCmdexecopt,
    IntPtr pvaIn,
    IntPtr pvaOut
)
int Exec(
    [InAttribute] Guid% pguidCmdGroup, 
    [InAttribute] unsigned int nCmdID, 
    [InAttribute] unsigned int nCmdexecopt, 
    [InAttribute] IntPtr pvaIn, 
    [InAttribute] IntPtr pvaOut
)
abstract Exec : 
        pguidCmdGroup:Guid byref * 
        nCmdID:uint32 * 
        nCmdexecopt:uint32 * 
        pvaIn:IntPtr * 
        pvaOut:IntPtr -> int
function Exec(
    pguidCmdGroup : Guid, 
    nCmdID : uint, 
    nCmdexecopt : uint, 
    pvaIn : IntPtr, 
    pvaOut : IntPtr
) : int
Parameters
- pguidCmdGroup 
 Type: Guid%- The GUID of the command group. 
- nCmdID 
 Type: UInt32- The command ID. 
- nCmdexecopt 
 Type: UInt32- Specifies how the object should execute the command. Possible values are taken from the OLECMDEXECOPT and OLECMDID_WINDOWSTATE_FLAG enumerations. 
- pvaIn 
 Type: IntPtr- The input arguments of the command. 
- pvaOut 
 Type: IntPtr- The output arguments of the command. 
Return Value
Type: Int32
This method returns S_OK on success. Other possible return values include the following.
| Return code | Description | 
| OLECMDERR_E_UNKNOWNGROUP | The pguidCmdGroup parameter is not null but does not specify a recognized command group. | 
| OLECMDERR_E_NOTSUPPORTED | The nCmdID parameter is not a valid command in the group identified by pguidCmdGroup. | 
| OLECMDERR_E_DISABLED | The command identified by nCmdID is currently disabled and cannot be executed. | 
| OLECMDERR_E_NOHELP | The caller has asked for help on the command identified by nCmdID, but no help is available. | 
| OLECMDERR_E_CANCELED | The user canceled the execution of the command. | 
Remarks
For information on the COM interface, see IOleCommandTarget::Exec
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.