If you’ve done any development with the shared recognizer, you’ve probably had problems determining when the shared recognizer is in sleep mode.
Determining when the shared recognizer is OFF is easy enough; ISpRecognizer::GetRecoState will return SPRST_INACTIVE.
But figuring out the sleep state is much harder. That’s because the shared recognizer is active (SPRST_ACTIVE_ALWAYS), but it’s not listening for all commands.
In Windows 7, there is a new interface that expose ‘categories’ (ISpRecognizer3).
NOTE WELL: This is only guaranteed to work on Windows 7. It is not guaranteed to work on future versions of Windows.
Some sample code to get an ISpRecognizer3 interface from a shared recognizer stored in m_cpReco:
In order to make this work, you’ll need to have the Windows 7 SDK installed and set as default in Visual Studio.
Also, you’ll need to make sure that you have the following version numbers defined (typically in targetver.h):
#define WINVER 0x0601
#define _WIN32_WINNT 0x0601
This will enable the Windows-7 only interfaces like ISpRecognizer3.