CHMlib Logo Leading Translation Management System for Translation Agencies, Top Translation Management Software for Freelance Translators, Time Tracking Software, Word Count, Character Count and Line Count Software, Computer Assisted Translation Tool for Easy Word Count, Clipboard Character Count Software, User-Friendly Translation Memory Software, Terminology Management Software, Terminology Management Server, Microsoft Glossary Software, Dictionary of Acronyms, Social Network for Translators and Translation Agencies, Acronyms and Abbreviations Search Engine, Russian Translation Lab, Ukrainian Translation Lab.
You are reading help file online using chmlib.com
CrisisHelper - First Aid in Tough Times of World Economic Crisis


The Microsoft.com Speech website Microsoft Speech SDK

SAPI 5.1

ISpGrammarBuilder::AddResource

ISpGrammarBuilder::AddResource adds a resource (name and string value) to the grammar rule specified in hRuleState. The resource can be queried by a rule interpreter using ISpCFGInterpreterSite::GetResourceValue().

HRESULT AddResource(
   SPSTATEHANDLE   hRuleState,
   const WCHAR    *pszResourceName,
   const WCHAR    *pszResourceValue
);

Parameters

hRuleState
[in] Handle of a state in the rule to which the resource is to be added.
pszResourceName
[in] Address of a null-terminated string specifying the resource name.
pszResourceValue
[in] Address of a null-terminated string specifying the resource value.

Return values

Value Description
S_OK Function completed successfully.
E_INVALIDARG At least one of the parameters is invalid.
SPERR_DUPLICATE_RESOURCE_NAME The resource already exists.
E_OUTOFMEMORY Exceeded available memory.
FAILED(hr) Appropriate error message.

Example

The following code snippet illustrates the use of AddResource.

    HRESULT hr = S_OK;

    SPSTATEHANDLE hInit;
    hr = pGrammarBuilder->GetRule(L"rule1", 1, 0, TRUE, &hInit);
	
    SPSTATEHANDLE hState;
    hr = pGrammarBuilder->CreateNewState(hInit, &hState);
    // Check hr

    // AddResource using the hInitState
    hr = pGrammarBuilder->AddResource(hInit, L"ResName1", L"ResValue1");
    // Check hr

    // AddResource using hState != hInit
    hr = pGrammarBuilder->AddResource(hState, L"ResName2", L"ResValue2");
    // Check hr


You are reading help file online using chmlib.com

If you want your help file to be removed or added please send e-mail to chmlibcom@gmail.com
Partner sites: Logo Design, Simple Anti-Crisis Accounting Software, Voice Search for Web