Partager via


ViewFilter.ExecCommand(Guid, UInt32, UInt32, IntPtr, IntPtr) Method

Definition

Override this method to intercept the IOleCommandTarget::Exec call.

protected:
 virtual int ExecCommand(Guid % guidCmdGroup, System::UInt32 nCmdId, System::UInt32 nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut);
protected virtual int ExecCommand (ref Guid guidCmdGroup, uint nCmdId, uint nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut);
abstract member ExecCommand : Guid * uint32 * uint32 * nativeint * nativeint -> int
override this.ExecCommand : Guid * uint32 * uint32 * nativeint * nativeint -> int
Protected Overridable Function ExecCommand (ByRef guidCmdGroup As Guid, nCmdId As UInteger, nCmdexecopt As UInteger, pvaIn As IntPtr, pvaOut As IntPtr) As Integer

Parameters

guidCmdGroup
Guid

[in] The GUID of the command group.

nCmdId
UInt32

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

nCmdexecopt
UInt32

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

pvaIn
IntPtr

nativeint

[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
IntPtr

nativeint

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

Returns

Usually returns 0 if ok, or OLECMDERR_E_NOTSUPPORTED

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.

Applies to