Speech-Recognition Enumerator

To create a speech-recognition enumerator, an application calls the CoCreateInstance function with the CLSID_SREnumerator class identifier and the IID_ISRFind interface identifier. This creates a speech-recognition enumeration object with an ISRFind interface that the application can use to find an engine.

After creating the speech-recognition enumerator and getting the address of its ISRFind interface, the application fills an SRMODEINFO structure with values that indicate the kind of engine the application is looking for, such as the language, the dialect, the engine features needed, the engine name, and so on. Any members of the SRMODEINFO structure that are not relevant to the application can be set to NULL. The application then calls the ISRFind::Find member function.

The Find member function, if it succeeds, fills a second SRMODEINFO structure with information about the closest matching speech-recognition mode available. Because this is only the closest match, the application should check the mode to see if it is acceptable. If not, the application can enumerate all of the engines to try again to find an acceptable mode (described in the next section), or the application can fail.

An application can rank certain characteristics more or less important than the engine's default rankings by filling an SRMODEINFORANK structure that indicates the priority of each member of the SRMODEINFO structure. The application specifies the address of the SRMODEINFORANK structure along with the SRMODEINFO structures when calling the Find member function.