Interface IOleCommandTarget
Enables objects and their containers to dispatch commands to each other. For example, an object's toolbars may contain buttons for commands such as Print, Print Preview, Save, New, and Zoom. IOleCommandTarget interface
Namespace: Dapplo.Windows.Com
Assembly: Dapplo.Windows.Com.dll
Syntax
public interface IOleCommandTarget
Methods
| Improve this Doc View SourceExec(Guid, Int32, Int32, IntPtr, IntPtr)
Executes the specified command or displays help for the command.
Declaration
int Exec(Guid pguidCmdGroup, int nCmdId, int nCmdexecopt, IntPtr pvaIn, IntPtr pvaOut)
Parameters
Type | Name | Description |
---|---|---|
Guid | pguidCmdGroup | The unique identifier of the command group; can be NULL to specify the standard group. |
System.Int32 | nCmdId | The command to be executed. This command must belong to the group specified with pguidCmdGroup. |
System.Int32 | nCmdexecopt | Specifies how the object should execute the command. Possible values are taken from the OLECMDEXECOPT and OLECMDID_WINDOWSTATE_FLAG enumerations. |
IntPtr | pvaIn | A pointer to a VARIANTARG structure containing input arguments. This parameter can be NULL. |
IntPtr | pvaOut | Pointer to a VARIANTARG structure to receive command output. This parameter can be NULL. |
Returns
Type | Description |
---|---|
System.Int32 | This method returns S_OK on success. Other possible return values include the following. 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. |
QueryStatus(Guid, Int32, IntPtr, IntPtr)
Queries the object for the status of one or more commands generated by user interface events.
Declaration
int QueryStatus(Guid pguidCmdGroup, int cCmds, IntPtr prgCmds, IntPtr pCmdText)
Parameters
Type | Name | Description |
---|---|---|
Guid | pguidCmdGroup | The unique identifier of the command group; can be NULL to specify the standard group. |
System.Int32 | cCmds | The number of commands in the prgCmds array. |
IntPtr | prgCmds | A caller-allocated array of OLECMD structures that indicate the commands for which the caller needs status information. This method fills the cmdf member of each structure with values taken from the OLECMDF enumeration. |
IntPtr | pCmdText | A pointer to an OLECMDTEXT structure in which to return name and/or status information of a single command. This parameter can be NULL to indicate that the caller does not need this information. |
Returns
Type | Description |
---|---|
System.Int32 | This method returns S_OK on success. Other possible return values include the following. E_FAIL The operation failed. E_UNEXPECTED An unexpected error has occurred. E_POINTER The prgCmds argument is NULL. OLECMDERR_E_UNKNOWNGROUP The pguidCmdGroup parameter is not NULL but does not specify a recognized command group. |