Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 1.41 KB

oncmdmsg-handler.md

File metadata and controls

19 lines (14 loc) · 1.41 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: OnCmdMsg Handler
OnCmdMsg Handler
11/04/2016
OnCmdMsg
messages, routing
handlers [MFC]
command routing [MFC], OnCmdMsg handler
handlers, OnCmdMessage [MFC]
OnCmdMessage method [MFC]
8df07024-506f-47e7-bba9-1c3bc5ad8ab6

OnCmdMsg Handler

To accomplish the routing of commands, each command target calls the OnCmdMsg member function of the next command target in the sequence. Command targets use OnCmdMsg to determine whether they can handle a command and to route it to another command target if they cannot handle it.

Each command-target class may override the OnCmdMsg member function. The overrides let each class route commands to a particular next target. A frame window, for example, always routes commands to its current child window or view, as shown in the table Standard Command Route.

The default CCmdTarget implementation of OnCmdMsg uses the message map of the command-target class to search for a handler function for each command message it receives — in the same way that standard messages are searched. If it finds a match, it calls the handler. Message-map searching is explained in How the Framework Searches Message Maps.

See also

How the Framework Calls a Handler