EnableMenuItem

Syntax

BOOL EnableMenuItem(hMenu,wIDEnableItem,wEnable)

This function enables, disables, or grays a menu item.

Parameter Type/Description  

hMenu HMENU Specifies the menu.  
wIDEnableItem WORD Specifies the menu item to be checked. The wIDEnableItem parameter can specify pop-up menu items as well as menu items.  
wEnable WORD Specifies the action to take. It can be a combination of MF_DISABLED, MF_ENABLED, or MF_GRAYED, with MF_BYCOMMAND or MF_BYPOSITION. These values can be combined by using the bitwise OR operator. These values have the following meanings:  
  Value Meaning
  MF_BYCOMMAND Specifies that the wIDEnableItem parameter gives the menu item ID (MF_BYCOMMAND is the default ID).
  MF_BYPOSITION Specifies that the wIDEnableItem parameter gives the position of the menu item (the first item is at position zero).
  MF_DISABLED Menu item is disabled.
  MF_ENABLED Menu item is enabled.
  MF_GRAYED Menu item is grayed.

Return Value

The return value specifies the previous state of the menu item. The return value is –1 if the menu item does not exist.

Comments

To disable or enable input to a menu bar, see the WM_SYSCOMMAND message.