Overriding the Standard Command Routing

OverviewHow Do I

In rare cases when you must implement some variation of the standard framework routing, you can override it. The idea is to change the routing in one or more classes by overriding OnCmdMsg in those classes. Do so:

  • In the class that breaks the order to pass to a nondefault object.

  • In the new nondefault object or in command targets it might in turn pass commands to.

If you insert some new object into the routing, its class must be a command-target class. In your overriding versions of OnCmdMsg, be sure to call the version that you’re overriding. See the member function of class CCmdTarget in the Class Library Reference and the versions in such classes as CView and CDocument in the supplied source code for examples.