ON_UPDATE_COMMAND_UI Macro
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 ON_UPDATE_COMMAND_UI Macro.
Use the Properties window to connect a user-interface object to a command-update handler in a command-target object. It will automatically connect the user-interface object's ID to the ON_UPDATE_COMMAND_UI
macro and create a handler in the object that will handle the update. See Mapping Messages to Functions for more information.
For example, to update a Clear All command in your program's Edit menu, use the Properties window to add a message-map entry in the chosen class, a function declaration for a command-update handler called OnUpdateEditClearAll
in the class declaration, and an empty function template in the class's implementation file. The function prototype looks like this:
afx_msg void OnUpdateEditClearAll(CCmdUI *pCmdUI);
Like all handlers, the function shows the afx_msg keyword. Like all update handlers, it takes one argument, a pointer to a CCmdUI
object.