IVoiceCmd::CmdMimic

This method supplies a voice-aware application with the equivalent of a spoken voice command.

Syntax

HRESULT CmdMimic( PVCMDNAME pMenu, PTSTR pszCommand);

Parameters

pMenu
[in] Pointer to a VCMDNAME structure identifying the menu that contains the command to mimic.
pszCommand
[in] Pointer to the null-terminated string that contains the command to mimic.

Return Values

NOERROR
The method successfully supplied a voice-aware application with the equivalent of a spoken voice command.
E_INVALIDARG
The argument is invalid.
VCMDERR_CANNOTMIMIC
No command was found to match the input string.
VCMDERR_INVALIDMODE
No site exists, the site does not support this attribute, or the voice command object is already registered with a site.
VCMDERR_MENUDOESNOTEXIST
The requested menu does not exist in the database.
VCMDERR_OUTOFMEM
There is no more memory.
VCMDERR_VALUEOUTOFRANGE
The value is out of range.

Remarks

CmdMimic parses the command string and eliminates white space and punctuation, then compares the result with each command on the voice menu until it finds a match. The comparison is case-insensitive, and the command string can include phrases from lists. If the string matches a command in the voice menu, it is recognized; otherwise, the method returns an error.

The VCMDERR_MENUDOESNOTEXIST error is returned if the menu does not exist or is not active.

An application can call CmdMimic to play back voice macros to another application, similar to playing back keystrokes and mouse messages in Windows.

The voice menu must be active before an application can mimic its commands.