Compartir a través de


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.

See Also

Concepts

How to: Update User-Interface Objects