Contents Previous Page Next Page
IOleCommandTarget

The IOleCommandTarget interface defines a simple and extensible mechanism whereby objects and their containers can 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. 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 document objects. The IOleCommandTarget interface provides a simpler means to achieve the same ends.

Available commands are defined by integer identifiers in a group. The group is identified itself with a GUID. The interface allows a caller both to query for support of one or more commands within a group and to issue an order to the object to execute a particular command.

Methods in VTable Order

IUnknown Methods                       Description                                    
                                                                                      
QueryInterface                         
Returns pointers to supported interfaces       
                                                                                      
AddRef                                 Increments reference count                     
                                                                                      
Release                                Decrements reference count                     
                                                                                      

IOleCommandTarget Methods              Description                                    
                                                                                      
QueryStatus                            
Queries object for status of commands          
                                                                                      
Exec                                   Execute a command