• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 74, 文章 - 0, 評論 - 26, 引用 - 0
            數據加載中……

            (msdn)Using MFC to Automate SAPI (SAPI 5.3)http://msdn2.microsoft.com/en-us/library/ms717069.aspx

            Microsoft Speech API 5.3   用oleview 可以產生 idl 文件 再用 midl工具 可以產生 tlb,h,c 存根文件 等.

            Using MFC to Automate SAPI

            Introduction

            The Microsoft Foundation Classes (MFC) provides an easy and convenient way to automate calls to SAPI using its Class Wizard to generate wrappers for the SAPI layer from the SAPI Type Library.

            In order to accomplish this, perform the following steps:

            1. Create a new MFCAppWizard(exe) project in Visual C++.
            2. Based on the type of application you are creating, follow the wizard prompts. In Step 3 of the wizard prompts, (or Step 2 if you are creating a Dialog Based application) make sure that the Automation check box is selected under the heading, What other support would you like to include?

            Once the new project is ready, access Class Wizard.

            1. Click the Automation tab, and then click Add Class and select From a type library in the drop-down list.
            2. Browse for the sapi.dll file and open it.
            3. Select the classes you would like Class Wizard to generate a wrapper for. The resulting default header and implementation files are sapi.h and sapi.cpp respectively. The rest of this document assumes that you have chosen to use these default file names. Click OK.
            4. You should now be back in the Class Wizard window. Click OK.
            After you are done with the above steps, Visual C++ will automatically add the Class Wizard generated files sapi.cpp and sapi.h to your project.

            Upon viewing the sapi.h file, you should notice that it is nothing more than an automation wrapper that has been generated for all the classes you selected. Notice that all the classes inherit from COleDispatchDriver, hence the dispatch interface needs to be set up. This only requires a few lines of simple code, after which the wrapper class can be used just like any other C++ class.

            Example

            This example assumes that you chose to generate a wrapper for the ISpeechVoice class from among any other classes you may have selected. Using the project created above, include the sapi.h file within a source file in the project that will make automation calls to SAPI using the wrapper. In that source file, type the following code.

            CLSID CLSID_SpVoice;    // class ID for the SAPI SpVoice object
            LPDISPATCH pDisp; // dispatch interface for the class
            ISpeechVoice voice; // use the MFC Class Wizard generated wrapper

            CLSIDFromProgID(L"SAPI.SpVoice", &CLSID;_SpVoice);
            voice.CreateDispatch(CLSID_SpVoice);
            pDisp = voice.m_lpDispatch;

            HRESULT hr = pDisp->QueryInterface(CLSID_SpVoice, (void**)&voice;.m_lpDispatch);

            if (hr == S_OK) {
            pDisp->Release();
            }
            else {
            voice.AttachDispatch(pDisp, TRUE);
            }

            voice.Speak("hello world", 1); // asynchronous call to Speak method of ISpeechVoice interface

            If you have been following the steps outlined above properly, you should hear your computer say "hello world!" That's all there is to using MFC to make automation calls to SAPI. Currently however, not all the wrapper classes generated by MFC's Class Wizard work properly. For instance, the ISpeechLexicon interface does not work. The work around for this is to implement your own automation wrapper classes using C++. The steps to do that are beyond the scope of this document. Of course, you can always use the COM interfaces in C++ and Automation in Visual Basic to ensure that every interface in SAPI works easily and flawlessly.

            posted on 2007-11-20 09:06 井泉 閱讀(1192) 評論(1)  編輯 收藏 引用 所屬分類: C++

            評論

            # re: (msdn)Using MFC to Automate SAPI (SAPI 5.3)http://msdn2.microsoft.com/en-us/library/ms717069.aspx[未登錄]  回復  更多評論   

            你好,我在試驗這個例子的時候遇見了問題。我不知道Example的那段代碼應該加到哪里。我試驗了一下,出現了錯誤。所以,希望你能詳細的指點我一下,可以么?謝謝啦!我的郵箱是:nvllnvll@126.com
            2010-03-19 22:07 | Harry
            久久亚洲欧洲国产综合| 亚洲欧美一区二区三区久久| 久久99精品久久久久久久久久| 无码专区久久综合久中文字幕| 久久久久久精品成人免费图片| 色偷偷88888欧美精品久久久| 久久亚洲精品视频| 久久婷婷国产剧情内射白浆 | 久久99精品国产一区二区三区| 色综合久久久久综合99| 精品久久久久久中文字幕大豆网 | 一本色道久久综合亚洲精品| 丁香五月网久久综合| 久久精品国产精品亚洲下载| 狠狠综合久久综合88亚洲| 色噜噜狠狠先锋影音久久| 久久中文字幕人妻熟av女| 国产一区二区精品久久| 国产亚洲精品久久久久秋霞| 国产福利电影一区二区三区久久久久成人精品综合 | 日本亚洲色大成网站WWW久久| 久久A级毛片免费观看| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 国产农村妇女毛片精品久久| 久久综合狠狠综合久久| 伊人久久大香线蕉精品不卡 | 伊人热人久久中文字幕| 亚洲精品乱码久久久久久久久久久久 | 久久精品亚洲精品国产色婷| 久久亚洲sm情趣捆绑调教| 久久久久久久久久久免费精品 | 99久久国产综合精品麻豆| 久久婷婷五月综合国产尤物app| 国产午夜精品久久久久九九| 大伊人青草狠狠久久| 久久国产精品99久久久久久老狼 | 99久久无码一区人妻| 九九精品99久久久香蕉| 久久精品无码一区二区无码| 久久天天躁狠狠躁夜夜网站 | 久久WWW免费人成—看片|