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

ISpRecoGrammar::SaveCmd

ISpRecoGrammar::SaveCmd allows applications using dynamic grammars to save the current grammar state to a stream.

HRESULT SaveCmd(
   IStream   *pSaveStream,
   WCHAR    **ppCoMemErrorText
);

Parameters

pSaveStream
[in] The stream to save the compiler binary grammar into.
ppCoMemErrorText
[out] Optional parameter of a null-terminated string containing error messages that occurred during the save operation.

Return values

Value Description
S_OK Function completed successfully.
E_INVALIDARG pSaveStream is invalid or bad.
SPERR_NOT_DYNAMIC_GRAMMAR Command was loaded but compiler is not available.
SPERR_UNINITIALIZED Compiler is not available.
E_POINTER ppCoMemErrorText is invalid or bad.
FAILED (hr) Appropriate error message.

Remarks

Applications can use ::SaveCmd to serialize grammar changes that were made at run time for use at a later time. See also ISpRecoGrammar::LoadCmdFromMemory.

Example

The following code snippet illustrates how to use ISpRecoGrammar::SaveCmd to serialize the CFG from one SpRecoGrammar object and deserialize it into another SpRecoGrammar object.

    HRESULT hr = S_OK;

    // ... build and use a SpRecoGrammar object

    // create a Win32 global stream
    hr = ::CreateStreamOnHGlobal(NULL, true, &cpHStream);
    // Check hr

    // save the current grammar to the global stream
    hr = cpRecoGrammar->SaveCmd(cpHStream, NULL);
    // Check hr

    // create the second grammar to deserialize into
    hr = cpRecoContext->CreateGrammar(0, &cpReloadedGrammar);
    // Check hr

    // get a handle to the stream with the serialized grammar
    ::GetHGlobalFromStream(cpHStream, &hGrammar);
    // Check hr

    // deserialize the CFG into a new grammar object
    hr = cpReloadedGrammar->LoadCmdFromMemory((SPBINARYGRAMMAR *)::GlobalLock(hGrammar), SPLO_DYNAMIC);
    // 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