Important: Please read the Qt Code of Conduct -

At wits end: SAPI + Qt = Fail

  • Hey guys,

    I have implemented a speech recognizer in a clean Visual Studio program's main function. It works perfectly.

    However, when I copied this code over to my project running Qt, and started implementing it as a QObject, it started spitting out error messages on the line:

    @hr = SpGetDefaultTokenFromCategoryId(SPCAT_AUDIOIN, &cpObjectToken);
    //hr == -2147200966 == SPERR_NOT_FOUND@

    More specifically, stepping into SpGetDefaulttokenFromCategoryId, it fails on this function call:

    @WCHAR * pszTokenId;
    hr = cpCategory->GetDefaultTokenId(&pszToken);
    //hr == -2147200966 == SPERR_NOT_FOUND@

    This is compiling fine, and calls a bunch of initializing functions (which return S_OK) before it reaches this line.

    I have asked this question on #qt, #winapi, MSDN forums, directly to Microsoft Researchers and now I'm here. Hopefully someone might know?

Log in to reply