IVCmdMenu::SetItem

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

Temporarily enables or disables a command on a voice menu. 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.

· Returns NOERROR if successful, or one of these error values:

E_INVALIDARG
VCMDERR_OUTOFMEM

dwEnable

[in] TRUE to enable the command or FALSE to disable it.

dwCmdNum

[in] 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] Flag that identifies the nature of dwCmdNum. This parameter can be one of these values:

VCMD_BY_IDENTIFIER
VCMD_BY_POSITION

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