The information in this article applies to:
SUMMARYThe message-map mechanism provided by the Microsoft Foundation Classes (MFC) can process WM_COMMAND messages for a constant ID. However, in some cases, an application needs to process WM_COMMAND messages for an ID that is not known until run time. This can occur when an application modifies menus or dynamically creates controls at run time. To process these messages, your application must override the CCmdTarget::OnCmdMsg() function. MORE INFORMATION
The Microsoft Foundation Classes provide both the ON_COMMAND() and
ON_UPDATE_COMMAND_UI() message-map macros to process WM_COMMAND messages.
The ON_COMMAND() macro dispatches a WM_COMMAND message generated when the
user selects a user interface object (for example, a control or a menu
item). The ON_UPDATE_COMMAND_UI() macro updates the status of the user
interface object that generates the WM_COMMAND message. Each of these
macros requires a constant for the command ID. If the command ID is not
known until run time, the message must be processed without using a message
map. Sample Code
REFERENCES
MFC Technical Note 6: Message Maps. Additional query words:
Keywords : kbDocView kbMFC kbVC100 kbVC150 kbVC200 kbVC400 kbGrpMFCATL kbArchitecture |
Last Reviewed: November 25, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |