IVCmdMenu::Add

This method adds one or more commands to a voice menu. The added commands are appended to any existing commands in the menu.

Syntax

HRESULT Add( DWORD dwCmdNum, SDATA dData, DWORD *pdwCmdStart);

Parameters

dwCmdNum
[in] Specifies the number of commands to add to the menu.
dData
[in] Specifies the SDATA structure that contains a list of VCMDCOMMAND structures that describe the voice commands to be added. Although they vary in size depending on the command data, the structures are contiguous within the list.
pdwCmdStart
[out] Pointer to a DWORD that receives the number of the first command added to the menu.

Return Values

NOERROR
The method successfully added the commands to the voice menu.
E_INVALIDARG
The argument is invalid.
VCMDERR_INVALIDCHAR
There is an invalid character in the voice menu.
VCMDERR_MENUTOOCOMPLEX
The menu is too complex to use.
VCMDERR_OUTOFMEM
There is no more memory.
VCMDERR_VALUEOUTOFRANGE
The value is out of range.

Remarks

For Auto PC, applications should use the IAPCSpeech::AddVMenuCommand method instead, but IVCmdMenu::Add is still available to Auto PC applications.

Commands are numbered sequentially from 1 to n. New commands are added to the end of the menu, so the first command added is numbered n+1.

For best results, deactivate the voice menu before calling Add. Otherwise, the menu must be deactivated, recompiled, and reactivated before Add returns. If the menu is already deactivated when Add is called, the menu is not recompiled until the application activates it again.

If a command string includes a list name, you can use IVCmdMenu::ListSet to set the phrases that the user can substitute for the list name when speaking the command.