Contents Index Topic Contents | ||
Previous Topic: IEnumOleDocumentViews::Skip Next Topic: IOleCommandTarget::Exec |
IOleCommandTarget
The IOleCommandTarget interface enables objects and their containers to determine if an object supports a command, to determine the status of a command, and to execute a command. For example, the container of an object can determine if the object supports the Paste command. If it does support the Paste command, the container can then determine if Paste can currently be executed. If the command can be executed, the container can use that information to enable its Paste command user interface. If the user selects Paste, the container can use this interface to execute the command on the object.
Normal in-place activation guidelines recommend that you remove or disable such buttons because no efficient, standard mechanism has been available to dispatch them to the container. Similarly, a container has heretofore had no efficient means to send commands such as Print, Page Setup, and Properties to an in-place active object. Such simple command routing could have been handled through existing OLE Automation standards and the IDispatch interface, but the overhead with IDispatch is more than is required in the case of Active Documents. The IOleCommandTarget interface provides a simpler means to achieve the same ends.
Available commands are defined by integer identifiers in a group. The group itself is identified with a GUID. The interface allows a caller both to query for support of one or more commands within a group and to issue a supported command to the object.
When to Implement
Implement IOleCommandTarget when your object supports one or more commands.
When to Use
Use IOleCommandTarget to determine the status of or execute a command implemented by an object.
Methods in Vtable Order
QueryStatus Queries an object for status of commands. Exec Executes a command.
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.