DictaionPad SAPI示例如何获取菜单和命令事件? [英] How does DictaionPad SAPI sample get menu and command events?

查看:83
本文介绍了DictaionPad SAPI示例如何获取菜单和命令事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有DictationPad SAPI示例,我正在尝试了解SAPI的工作原理。特别是,我试图在示例中弄清楚简单的短语"文件","打开"等。设法生成WM_COMMAND消息,该消息最终被处理为
以运行文件打开对话框。

I have the DictationPad SAPI example and am trying to understand how SAPI works. In particular, I am trying to figure out in the example how the simple phrases "File", "Open" manages to generate the WM_COMMAND message that ends up being processed to run the file open dialog.

我检查了cmdmode.xml文件并设置了多个断点。我仍然没有看到WM_COMMAND消息发送到应用程序的位置。有一个ProcessCommandModeCommands方法。我看到PID_CmdMenu正在那里处理。我还看到xml文件中定义的ID
及其语法规则:

I have examined the cmdmode.xml file and have set a number of breakpoints. Still I don't see where the WM_COMMAND message is sent to the application. There is a ProcessCommandModeCommands method. I see PID_CmdMenu being handled there. I also see that ID defined in the xml file and the grammar rule for it:

所以我在ProcessCommandModeCommands中设置了一个断点,但它没有被控制。然后我设置一个断点并跳过对LoadCmdFromResource的调用,该调用使用ISpRecoGrammar加载已编译的cmdmode.xml文件。我想当我说"文件"时"开"
表示不会调用WM_COMMAND消息处理程序。但它是。 "文件"导致示例应用程序的文件菜单下降并"打开"导致带有ID_FILE_OPEN的WM_COMMAND被发送到应用程序。

So I set a breakpoint in ProcessCommandModeCommands but it isn't triped. Then I set a breakpoint and skip the call to LoadCmdFromResource which uses ISpRecoGrammar to load the compiled cmdmode.xml file. I figured when I say "File" "Open" that the WM_COMMAND message handler would not be called. But it is. "File" causes the File menu of the sample app to drop and "Open" causes the WM_COMMAND with ID_FILE_OPEN to be sent to the app.

有人能告诉我文件菜单和打开命令实际上是由语音驱动的吗?如果cmdmode.xml编译语法不涉及选择命令,它有什么用?

Can someone tell me how it is that the file menu and open command are actually being driven by voice? And what use are the cmdmode.xml compiled grammar if it isn't involved with selecting the command?

如果这是在操作系统中更深入的内容,那么现代的"流畅"将如何?功能区选项卡/基于组/控件的UI使用语音来选择和启动命令?

If this is something built deeper into the OS, how would a modern "fluent" ribbon tab/group/control based UI use speech to select and start commands?

R.D。荷兰

推荐答案

您好,

感谢您在此发布。

>>有人可以告诉我文件菜单和打开命令实际上是由语音驱动的吗? cmdmode.xml编译语法有什么用处它不参与选择命令?

语音应用程序通常使用无上下文语法(CFG)来解析识别器输出,在某些情况下,充当识别器的语言模型。语音识别引擎使用CFG将用户的单词约束为它将识别的单词。
根据cmdmode.xml文件的内容和名称,它用于构建命令菜单属性。

Speech applications often use context-free grammars (CFG) to parse the recognizer output and in some instances, to act as the recognizer's language model. Speech recognition engines use CFGs to constrain the user's words to words that it will recognize. According to the content and name of the cmdmode.xml file, it's used to build command menu properties.

对于这种情况,我建议你在这个页面上发帖并联系作者提供更好的支持。

For this case, I suggest you post on this page and contact the author for better support.

https://github.com/pauldotknopf/WindowsSDK7-样品/问题

您的理解与合作将不胜感激。

Your understanding and cooperation will be grateful.

最诚挚的问候,

Baron Bi

Baron Bi


这篇关于DictaionPad SAPI示例如何获取菜单和命令事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆