You can display a check mark next to a menu item to indicate that the user has chosen it. Typically, you check an item when it is part of a group of items that are mutually exclusive. The check mark indicates the user's latest choice. For example, if a group consists of the commands Left, Right, and Center, your application might check the Left command to indicate that the user chose that command most recently.
In the resource-definition file, you can specify whether a menu item is initially checked. To do so, use the CHECKED option in the MENUITEM statement. For example, the following MENUITEM statement specifies that the Left menu item is initially checked:
MENUITEM
"Left", IDM_LEFT, CHECKED
The information in the resource-definition file applies only to the initial state of the menu. You can check or clear a menu item later, using the CheckMenuItem function in your C-language source file. CheckMenuItem checks or clears a specified menu item.
The following example places a check mark next to the item whose menu identifier is IDM_LEFT:
CheckMenuItem
(hMenu, IDM_LEFT, MF_CHECKED);
To clear (or “uncheck”) a menu item, you call the CheckMenuItem function and specify the value MF_UNCHECKED. The following example clears the check mark (if any) from the item whose menu identifier is IDM_RIGHT:
CheckMenuItem
(hMenu, IDM_RIGHT, MF_UNCHECKED);
If you change the menus in the menu bar, you must call the DrawMenuBar function to display the changes.