IVCmdMenu::Activate

HRESULT Activate(HWND hWndListening, DWORD dwFlags);

Activates a voice menu so that its commands can be recognized.

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

E_INVALIDARG
VCMDERR_CANTCREATEDATASTRUCTURES
VCMDERR_CANTINITDATASTRUCTURES
VCMDERR_CANTXTRACTWORDS
VCMDERR_INVALIDWINDOW
VCMDERR_MENUACTIVE
VCMDERR_MENUTOOCOMPLEX
VCMDERR_MENUWRONGLANGUAGE
VCMDERR_NOCACHEDATA
VCMDERR_NOENGINE
VCMDERR_NOGRAMMARINTERFACE
VCMDERR_OUTOFMEM
VCMDERR_TOOMANYMENUS

hWndListening

[in] Handle of the window associated with the voice menu. Whenever this window is the foreground window, the voice menu is automatically activated. Otherwise, it is deactivated. If this parameter is NULL, the voice menu is global (that is, it remains active regardless of the foreground window, until the application explicitly deactivates it).

dwFlags

[in] Flag that indicates whether the menu should be active when speech-recognition is "asleep" for the voice-command site. This parameter can be one of these values:

Value

Meaning

0 or NULL

The voice menu is active only when speech recognition is awake.

VWGFLAG_ASLEEP

The menu is active only when speech recognition is asleep and is automatically deactivated when speech recognition is awake.


Most applications set this parameter to zero. Typically, a sleep menu contains a command to resume speech recognition, such as "Wake up."

A global voice menu is useful for an application such as a clock program so that the user can ask what time it is and get a response no matter what else he or she is doing. Global voice-menu commands have a lower priority in case of a recognition conflict — for example, two commands with the same name in different menus.