UINT CheckMenuItem( UINT nIDCheckItem, UINT nCheck );
nIDCheckItem
Specifies the menu item to be checked, as determined by nCheck.
nCheck
Specifies how to check the menu item and how to determine the item's position in the menu. The nCheck parameter can be a combination of MF_CHECKED or MF_UNCHECKED with MF_BYPOSITION or MF_BYCOMMAND flags. These flags can be combined by using the bitwise OR operator. They have the following meanings:
Value | Interpretation of nCheck |
MF_BYCOMMAND | Specifies that the parameter gives the command ID of the existing menu item. This is the default if neither MF_BYCOMMAND nor MF_BYPOSITION is set. |
MF_BYPOSITION | Specifies that the parameter gives the position of the existing menu item (the first item is at position 0). |
MF_CHECKED | Acts as a toggle in conjunction with MF_UNCHECKED to place the default check mark next to the item. When the application supplies check-mark bitmaps (see SetMenuItemBitmaps), the “check mark on” bitmap is displayed. |
MF_UNCHECKED | Acts as a toggle in conjunction with MF_CHECKED to remove a check mark next to the item. When the application supplies check-mark bitmaps (see SetMenuItemBitmaps), the “check mark off” bitmap is displayed. |
Adds check marks to or removes check marks from menu items in the pop-up menu. The nIDCheckItem parameter specifies the item to be modified.
The nIDCheckItem parameter may identify a pop-up menu item as well as a menu item. No special steps are required to check a pop-up menu item. Top-level menu items cannot be checked. A pop-up menu item must be checked by position since it does not have a menu-item identifier associated with it.
The previous state of the item: MF_CHECKED or MF_CHECKED, or -1 if the menu item did not exist.
CMenu::GetMenuState, ::CheckMenuItem