⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rumen.htm

📁 这是用C++实现语音识别的一个插件。大家一起分享一下!
💻 HTM
📖 第 1 页 / 共 5 页
字号:
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    //填充主页面信息</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    ddsd.dwSize = sizeof( ddsd );</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    ddsd.dwFlags = DDSD_CAPS;</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    </span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    //创建主页面对象</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    if ( lpDD-&gt;CreateSurface( &amp;ddsd, &amp;lpDDSPrimary, NULL ) != DD_OK)</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    return FALSE;</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    </span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    //输出文字</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    if ( lpDDSPrimary-&gt;GetDC(&amp;hdc) != DD_OK) return FALSE; </span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    </span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    SetBkColor( hdc, RGB( 0, 0, 255 ) );</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    SetTextColor( hdc, RGB( 255, 255, 0 ) );</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    TextOut( hdc, 220, 200, szMsg1, lstrlen(szMsg1));</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    TextOut( hdc, 280, 240, szMsg2, lstrlen(szMsg2));</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    lpDDSPrimary-&gt;ReleaseDC(hdc);</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    return TRUE;</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">} </span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"> </p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">//******************************************************************</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">//函数:FreeDDraw()</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">//功能:释放所有的DirectDraw对象。</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">//******************************************************************</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">void 
    FreeDDraw( void )</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">{</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    if( lpDD != NULL )</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    {</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    if( lpDDSPrimary != NULL )</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    {</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    lpDDSPrimary-&gt;Release();</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    lpDDSPrimary = NULL;</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    }</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    lpDD-&gt;Release();</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    lpDD = NULL;</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">&nbsp;&nbsp;&nbsp; 
    }</span></font></p>
    <p
    style="background-color: rgb(0,0,128); margin-top: 0; margin-bottom: 0; padding-top: 2px"><font
    face="宋体"><span style="background-color: rgb(0,0,128); color: rgb(255,255,255)">}</span></font></p>
    <font face="宋体" size="3">
  </ol>
  <ol>
    <li>为了简化代码,这第一个入门程序没有头文件。在进行编译之前,还得进行最后的设置。选择<font
      SIZE="3">Project</font>菜单的<font SIZE="3">Settings…</font>,出现工程设置对话框。选择<font
      SIZE="3">Link</font>栏,在<font SIZE="3">Object/Library modules</font>中添入“<font
      SIZE="3">Ddraw.lib</font>”。使对话框如图所示。</li>
  </ol>
  <p ALIGN="CENTER"></font><a HREF="file:///D:/FrontPage/temp/pic/hello3.gif"><font SIZE="3">pic\hello3.gif</font></a></p>
  <font face="宋体" size="3"><ul>
    <li><font color="#FF0000">请注意:这一步骤是将DirectDraw的静态连接库文件连接到工程中,否则,程序虽然可以正常编译,但是在连接时会产生一个“unresolved 
      external symbol”(没有定义的外部符号)的错误。在以后所有的DirectDraw程序中,都必须将与你所用到的DirectDraw组件相应的静态连接库添入到这个设置中。</font></li>
  </ul>
  <p ALIGN="JUSTIFY">至此,一个最基本的</font><font SIZE="3">DirectDraw</font><font
  FACE="宋体" SIZE="3">应用程序已创建完毕,你现在不必去深究这些代码的含义,在下面及以后的章节中我们会对它们进行详细的分析。这虽不是一个最简单的</font><font
  SIZE="3">DirectDraw</font><font FACE="宋体" SIZE="3">应用程序,但它确实是一个能够实现最基本的输出功能的</font><font
  SIZE="3">DirectDraw</font><font FACE="宋体" SIZE="3">程序。</p>
  <p ALIGN="JUSTIFY">按</font><font SIZE="3">F7</font><font FACE="宋体" SIZE="3">编译成功后,按</font><font
  SIZE="3">Ctrl+F5</font><font FACE="宋体" SIZE="3">,执行该程序,显示器将切换到</font><font
  SIZE="3">640*480*256</font><font FACE="宋体" SIZE="3">色模式,黑屏后,屏幕中央会打印出蓝底黄字“</font><font
  SIZE="3">Hello World, I am DirectDraw boy !</font><font FACE="宋体" SIZE="3">”,除了输出这些字符外,这个程序什么也不做。按</font><font
  SIZE="3">ESC</font><font FACE="宋体" SIZE="3">可退出程序。程序运行结果如下图</p>
  <p ALIGN="CENTER"></font><a HREF="file:///D:/FrontPage/temp/pic/hello4.GIF"><font SIZE="3">pic\hello4.GIF</font></a></p>
  <font FACE="宋体" SIZE="3"><p ALIGN="JUSTIFY">这就是</font><font SIZE="3">DirectDraw</font><font
  FACE="宋体" SIZE="3">?有的人也许会对</font><font SIZE="3">DirectDraw</font><font
  FACE="宋体" SIZE="3">感到很失望,因为它并没有为我们表现出神奇的功能啊?但有的人却会对此感到异常兴奋,他们觉得一扇充满诱惑的房间的大门正向他们打开。这就象透过天窗,有些人只会看到黑暗的夜空,有些人却能看见满天的星星一样。第一个例子,为了使程序不至于太长而让那些初学者望而生畏,所以只能一再简化(尽管这样,整个程序还是占用了相当大的篇幅)。在后续章节的例子中,你们会看到程序会一个比一个更精彩。</p>
  <hr>
  <b><p><a name="3、分析代码">3、分析代码</a></b><ol>
    <ol>
      <p ALIGN="right"><font color="#FF0000" FACE="宋体" SIZE="3"><a href="#目录"
      style="color: rgb(255,0,0)"><b>回到目录</b></a></font></p>
    </ol>
  </ol>
  <p ALIGN="JUSTIFY">下面,让我们来逐一分析一下这个程序。</p>
  <b><p><a name="1)程序结构">1)程序结构</a></p>
  </b><p ALIGN="right"><font color="#FF0000" FACE="宋体" SIZE="3"><a href="#目录"
  style="color: rgb(255,0,0)"><b>回到目录</b></a></font></p>
  <p ALIGN="JUSTIFY">分析程序应该是一个由外而内,逐步求精的过程。首先从大的方面来看,这个程序一共用到了五个函数,如果按照正常顺序,排除程序中出错的可能,它们的调用顺序依次是这样的。</p>
  <b><p ALIGN="JUSTIFY">WinMain ----&gt; InitWindow ----&gt; InitDDraw ----&gt; WinProc 
  ----&gt; FreeDDraw</p>
  <p ALIGN="JUSTIFY">WinMain</b>:所有<font SIZE="3">Win32</font>应用程序的入口函数,它也是应用程序关闭时的出口,一个应用程序的全生命周期就是在它的控制之下。所以,确切的说,其它四个函数是被包括在<font
  SIZE="3">WinMain</font>之内的。消息循环也是在这个函数中启动。</p>
  <b><font SIZE="3"><p ALIGN="JUSTIFY">InitWindow</font></b>:初始化和创建一个与程序的<font
  SIZE="3">HINSTANCE</font>(实例句柄)相关联的主窗口,这个窗口的<font
  SIZE="3">HWND</font>(窗口

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -