IVCmdMenu::SetItem

This method temporarily enables or disables a command on a voice menu.

Syntax

HRESULT SetItem( DWORD dwEnable, DWORD dwCmdNum, DWORD dwFlag);

Parameters

dwEnable
[in] 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.
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 enabled or disabled a command on a voice menu temporarily.
E_INVALIDARG
The argument is invalid.
VCMDERR_OUTOFMEM
There is no more memory.

Remarks

If a command is disabled by using SetItem, the voice command object sends a CommandOther notification rather than a CommandRecognize notification when it recognizes the disabled command.

SetItem is much faster than the IVCmdMenu::EnableItem method because the menu is not recompiled. This means that SetItem can be called on an active menu without affecting performance.