需要帮助加载Cortana VCD文件上使用c++ DirectX/XAML
Need help loading Cortana VCD file on using C++ DirectX/XAML
我将Cortana添加到DirectX/XAML windows 10游戏中。我能找到的每一个例子都是用c#给出的,而不是c++。正常情况下,这不会是一个问题,但显然我没有在c++中正确地实现它,需要一些帮助。
这段代码的目的是加载一个VCD文件,Cortana使用它来执行我的应用程序相关的语音命令。我已经使用标准示例创建了VCD文件。
这是我在c++中难以实现的特定c#代码:
var storageFile =
await Windows.Storage.StorageFile.GetFileFromApplicationUriAsync(
new Uri("ms-appx:///myvcdfile.xml"));
await
Windows.ApplicationModel.VoiceCommands.VoiceCommandDefinitionManager.
InstallCommandDefinitionFromStorageFileAsync(storageFile);
我尝试的c++实现是:
Uri^ uri = ref new Uri("ms-appx:///myvcdfile.xml");
create_task(StorageFile::GetFileFromApplicationUriAsync(uri)).then([](task<StorageFile^> t) {
StorageFile^ sfile = t.get();
Windows::ApplicationModel::VoiceCommands::VoiceCommandDefinitionManager::InstallCommandDefinitionsFromStorageFileAsync(sfile);
});
当我运行这个时,没有抛出任何可见的错误(没有立即崩溃),但在输出窗口中抛出以下异常:
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x40080201: WinRT originate error (parameters: 0x8000000B, 0x00000040, 0x018BE280).
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x00000005: Access is denied.
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x000006D9: There are no more endpoints available from the endpoint mapper.
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x000006D9: There are no more endpoints available from the endpoint mapper.
Exception thrown at 0x76473E28 (KernelBase.dll) in darksong.exe: 0x40080201: WinRT originate error (parameters: 0x80004005, 0x00000013, 0x0EEAF160).
"访问被拒绝"错误让我认为有一些问题打开文件本身,虽然如果我故意输入一个无效的文件名,这是一个完全不同的错误崩溃,所以我知道它正在寻找文件,但也许是有一些问题实际上访问它?
另外,即使我排除了"InstallCommandDefinitionsFromStorageFileAsync()"行,异常仍然被抛出。
任何帮助都是感激的,提前感谢!
您的xml文件中肯定有错误(例如,如果您在命令中设置了使用PhraseList的项,但您忘记了xml中的PhraseList节点)
相关文章:
- 如何在directx/c++中进行平移/缩放操作
- DrawIndexedInstanced 具有不同的 Index Count per Instance (Directx
- Directx 11 - CompileFromFile() is not compiling
- 字节数组初始化会导致 DirectX 崩溃
- 在 DirectX 11 中从 GPU 读回顶点缓冲区(并获取顶点)
- 是否可以使用 DirectX 3D 11 绘制由三角形组成的圆?
- Directx 12 :在两个进程之间共享图形内存
- DirectX 11 如何处理来自 GPU 上的 sharedHandle 的图像
- > 64k C++的 DirectX 大型机型
- Linking DirectX
- C++ Visual Studio 错误:名称后跟'::'必须是类或命名空间名称 (DirectX 11)
- DirectX 11 - 点光源阴影
- DirectX 12 和 C++ CLI :无法使用IID_PPV_ARGS
- DirectX 11 -- Hello Triangle 未呈现 -- 原因:运行时库C++多线程
- DirectX 11 引擎在第三次代码改进后没有突然运行,我不知道为什么
- 如何防止 DirectX C++程序的拉伸/缩放
- 什么是 DirectX 9 中的数据流?
- DirectX 9 在重置调用之间保留状态
- 无法使用 Visual Studio 启动 DirectX 11 可执行文件,生成工作正常
- 如何在 DirectX 中初始化 XMVECTOR?