IVCmdMenu::EnableItem
This method permanently enables or disables a menu item. When a command is disabled by using EnableItem, it is not compiled into the menu.
Syntax
HRESULT EnableItem( DWORD dwEnable, DWORD dwCmdNum, DWORD dwFlag);
Parameters
- dwEnable
- [in] Specifies whether the command is enabled. Set to TRUE to enable the command, or to FALSE to disable it.
- dwCmdNum
- [in] Specifies the position or identifier of the command on the menu, depending on the value of dwFlag. Command positions are sequential, starting with 1 for the first command on the menu. The command identifier is specified in the dwID member of the VCMDCOMMAND structure that defines the command.
- dwFlag
- [in] Specifies the nature of dwCmdNum. It is one of the following flags:
- VCMD_BY_IDENTIFIER
- The dwCmdNum parameter is the identifier of the command.
- VCMD_BY_POSITION
- The dwCmdNum parameter is the position in the list of commands.
Return Values
- NOERROR
- The method successfully and permanently enabled or disabled the menu item.
- E_INVALIDARG
- The argument is invalid.
- VCMDERR_OUTOFMEM
- There is no more memory.
Remarks
For best results, deactivate the voice menu before calling EnableItem. Otherwise, the menu must be deactivated, recompiled, and reactivated before the method returns. If the menu is already deactivated when EnableItem is called, the menu is not recompiled until the application activates it again.