creating SAPI 5 recognition profile without using the control panel RRS feed

  • Question

  • I am writing a method to create a new SAPI 5 user recognition profile using the following stack overflow posting.

    So I have created all the necessary objects and categories as per instructed by EB but not quite sure how you do the actual "adding" of the profile? The code I am posting seems to amend existing profile information in the registry as opposed to adding a new profile? I guess the problem lies with profileObjectToken.SetId in terms of initialising it properly as a new profile ID but if I follow the advice from the post above and set the first parameter to null I get a 0x80045001 which is the profile ObjectToken is not initialised properly.

    Any help greatly appreciated?

    // Initialise category of object tokens
        SpObjectTokenCategory profileObjectTokenCategory = new SpObjectTokenCategory(); 
        // Set category type to profile object tokens
        profileObjectTokenCategory.SetId(SpeechStringConstants.SpeechCategoryRecoProfiles, true);
        //Create new object token for profile
        SpObjectToken profileObjectToken = new SpObjectToken();
        // SetId of profileObjectToken THIS IS WHERE THE PROBLEM LIE
        profileObjectToken.SetId(profileObjectTokenCategory.Default,/* @"HKEY_CURRENT_USER\SOFTWARE\Microsoft\Speech\RecoProfiles\Tokens"*/
        SpeechStringConstants.SpeechCategoryRecoProfiles, true);
        // set the description
        profileObjectToken.DataKey.SetStringValue(null, "testProfile");

    • Edited by scocia888 Sunday, September 23, 2018 5:15 PM
    Sunday, September 23, 2018 5:15 PM


All replies