BOOL EnableMenuItem(hmenu, uItem, fuFlags) | |||||
HMENU hmenu; | /* handle of menu | */ | |||
UINT uItem; | /* menu-item to enable, disable, or gray | */ | |||
UINT fuFlags; | /* menu-item flags | */ |
The EnableMenuItem function enables, disables, or grays (dims) the given menu item.
hmenu
Identifies the menu.
uItem
Specifies the menu item to be enabled, disabled, or grayed, as determined by the fuFlags parameter.
fuFlags
Specifies flags that control the interpretation of the uItem parameter and whether the menu item is enabled, disabled, or grayed. This parameter can be a combination of either MF_BYCOMMAND or MF_BYPOSITION, and MF_ENABLED, MF_DISABLED, or MF_GRAYED.
Value | Meaning |
MF_BYCOMMAND | The uItem parameter specifies the identifier of the menu item. |
MF_BYPOSITION | The uItem parameter specifies the zero-based relative position of the menu item. |
MF_DISABLED | The menu item is disabled so that it cannot be selected, but it is not grayed. |
MF_ENABLED | The menu item is enabled so that it can be selected, and is restored from the grayed state. |
MF_GRAYED | The menu item is disabled so that it cannot be selected, and it is grayed. |
The return value specifies the previous state of the menu item. It is either MF_DISABLED, MF_ENABLED, or MF_GRAYED. The return value is 0xFFFFFFFF if the menu item does not exist.
For information about enabling or disabling input to a menu bar, see the description of the WM_SYSCOMMAND message.
The uItem parameter can specify an item in a menu bar or in a pop-up menu.
GetMenuItemID