Current location - Recipe Complete Network - Complete cookbook - How does MFC make menu items add a checkmark in front after they are selected?
How does MFC make menu items add a checkmark in front after they are selected?
Respond to the command message and UPDATA_COMMAND_UI message of the menu item. Add a member variable IsCheck to the class of BOOL type, and add the code IsCheck =! IsCheck adds pcmdui- > function in UPDATA_COMMAND_UI; set check(is select); If it's a document, that's fine. If it is a dialog box, you should add a function to InitMenuPopup yourself.