Udostępnij za pośrednictwem


COleCmdUI Class

Implements a method for MFC to update the state of user-interface objects related to the IOleCommandTarget-driven features of your application.

class COleCmdUI : public CCmdUI

Remarks

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.

Requirements

Header: afxdocobj.h

See Also

Reference

CCmdUI Class

Hierarchy Chart

Other Resources

COleCmdUI Members