Search code examples
c++visual-c++sapi

Getting the Microsoft SAPI Version in code


I would like to be able to get the version of SAPI that my C++ application is using, and then display it to the user.

The problem is I cannot figure out how to get the version out of the SAPI interface.


Solution

  • _SAPI_BUILD_VER is a constant in sapi.h (and sapi.idl) that defines which version of SAPI you're building against.

    It's based on the Win32 build version (_WIN32_WINNT).

    For Windows 7, it's 0x054; for Vista, it's 0x053, and for XP, it's 0x051.

    If you need to find out at runtime, QI for interfaces that are only defined in 5.4 (ISpRecognizer3, for example) or 5.3 (ISpRecognizer2).

    For voices, generally speaking, the available voices change depending on the installed version.