c++ - 尝试关闭 DesktopWindowXamlSource 时抛出异常
问题描述
我正在为我的 Win32 C++ 应用程序使用 UWP Xaml 托管 API。我有以下代码:
winrt::Windows::UI::Xaml::Hosting::WindowsXamlManager XamlManager = winrt::Windows::UI::Xaml::Hosting::
WindowsXamlManager::InitializeForCurrentThread();
winrt::Windows::UI::Xaml::Hosting::DesktopWindowXamlSource XamlSource;
当我完成 UWP 内容时,我正在打电话
XamlSource.Close();
XamlManager.Close();
但是调试器的输出窗口表明正在抛出异常:
windows\advcore\winrt\iwindow\corewindow\desktop\desktopwindowcontentbridge.cpp(499)\Windows.UI.dll!00007FFD91CD860F: (caller: 00007FFD91CD7704) ReturnHr(1) tid(7168) 8007139F The group or resource is not in the correct state to perform the requested operation.
我究竟做错了什么?
解决方案
您是否展示了您的应用程序?
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">unaware</dpiAwareness>
</windowsSettings>
</application>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<maxversiontested Id="10.0.18362.0"/>
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
</application>
</compatibility>
</assembly>
从我的文章。
推荐阅读
- mysql - Spring JPA:多个 Aurora RDS MySQL 操作花费了太多时间
- python - 使用字典在 Python 中高效计算词频
- join - bigquery 连接中的可疑别名问题
- multithreading - freemarker 是否支持并行渲染为 pebble
- ansible - 如何在ansible中从stdout.lines中提取准确的输出
- java - jdbcTemplate batchUpdate 正在抛出 java.lang.ClassCastException:java.util.ArrayList 无法强制转换
- python - 路径函数在 python IDLE 和 google colab 中的工作方式是否不同?
- python - 阻止 pandas 静默转换超过 dtype 限制的数字
- excel - 导出到复制的文件
- python - 在 GF(5^2) 上创建多项式环时引发错误