CMenu::EnableMenuItem

Syntax

UINT EnableMenuItem( UINT nIDEnableItem, UINT nEnable );

Parameters

nIDEnableItem

Specifies the menu item to be enabled, as determined by nEnable.

nEnable

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 Interpretation of nEnable

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_DISABLED Disables the menu item so that it cannot be selected, but does not dim it.
MF_ENABLED Enables the menu item so that it can be selected, and restores it from its dimmed state.
MF_GRAYED Disables the menu item so that it cannot be selected, and dims it.

Remarks

Enables, disables, or dims a menu item.

Return Value

Previous state (MF_DISABLED, MF_ENABLED, or MF_GRAYED) or -1 if not valid.

See Also

CMenu::GetMenuState, ::EnableMenuItem