Freigeben über


Overriding the Standard Command Routing

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Overriding the Standard Command Routing.

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 OnCmdMsg member function of class CCmdTarget in the MFC Reference and the versions in such classes as CView and CDocument in the supplied source code for examples.

See Also

How the Framework Calls a Handler