Share via


The ON_UPDATE_COMMAND_UI Macro

OverviewHow Do ISample

Use ClassWizard 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.

For example, the Scribble tutorial in Tutorials updates a Clear All command in its Edit menu. In the tutorial, ClassWizard adds 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.