COleCmdUI Class
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

COleCmdUI Class

class COleCmdUI : public CCmdUI


The COleCmdUI class implements a method for MFC to update the state of user-interface objects related to the IOleCommandTarget-driven features of your application. In an application that is not enabled for DocObjects, when the user views a menu in the application, MFC processes UPDATE_COMMAND_UI notifcations. Each notification is given a CCmdUI object that can be manipulated to reflect the state of a particular command. However, when your application is enabled for DocObjects, MFC processes UPDATE_OLE_COMMAND_UI notifications and assigns COleCmdUI objects.

COleCmdUI allows a DocObject to receive commands that originate in its container's user interface (such as FileNew, Open, Print, and so on), and allows a container to receive commands that originate in the DocObject's user interface. Although IDispatch could be used to dispatch the same commands, IOleCommandTarget provides a simpler way to query and execute because it relies on a standard set of commands, usually without arguments, and no type information is involved. COleCmdUI can be used to enable, update, and set other properties of DocObject user interface commands. When you want to invoke the command, call COleServerDoc::OnExecOleCmd.

For further information on DocObjects, see CDocObjectServer and CDocObjectServerItem. Also see Internet First Steps: Active Documents and Active Documents.


Header: afxdocobj.h

See Also

Class Members | Base Class | Hierarchy Chart

© 2016 Microsoft