相关疑难解决方法(0)

C++/WinRT,Windows SDK 17134的一部分与Visual Studio 15.8 Preview 3不兼容

尝试编译以下代码:

#include <winrt/base.h>

int main() {}
Run Code Online (Sandbox Code Playgroud)

使用以下编译器选项:

/permissive- /std:c++latest
Run Code Online (Sandbox Code Playgroud)

随着最近发布的Visual Studio 15.8 Preview 3.0导致以下编译错误:

1>------ Build started: Project: test1, Configuration: Debug x64 ------
1>Source.cpp
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\cppwinrt\winrt\base.h(2185): error C3861: 'from_abi': identifier not found
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\cppwinrt\winrt\base.h(2185): note: This diagnostic occurred in the compiler generated function 'conditional<_Test,T,_Ty2>::type winrt::impl::as(From *)'
1>        with
1>        [
1>            _Ty2=winrt::com_ptr<T>
1>        ]
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\cppwinrt\winrt\base.h(2209): error C3861: 'from_abi': identifier not found
1>c:\program files (x86)\windows kits\10\include\10.0.17134.0\cppwinrt\winrt\base.h(2209): note: This diagnostic occurred in the compiler generated …
Run Code Online (Sandbox Code Playgroud)

c++ c++-winrt

8
推荐指数
1
解决办法
1538
查看次数

用于更新 MFC 应用程序窗口的 C++11 线程。需要 SendMessage()、PostMessage() 吗?

在花了一些时间使用 C++/CX 和 ++/WinRT 开发简单的 UWP 应用程序后,我开始享受针对该环境进行 Windows UI 应用程序开发的一些功能。

现在必须回到更熟悉的 MFC 应用程序开发,我想将我的方法更改为类似于 UWP 应用程序开发的方法。其想法是使用异步 C++11 线程生成内容并修改 MFC UI 中显示的内容。

我想要做的主要更改是使用 C++11 线程来卸载一些耗时的任务,并使这些线程将结果传达回主 MFC UI。

我希望卸载到 C++11 线程上的一些任务(与我在 UWP 应用中使用 C++/CX 和 C++/WinRT 的异步任务使用的任务类似)是:

  • 连接到另一台计算机并与之交换数据
  • 打开数据文件并解析它以更新 UI 视图
  • 将数据文件转换为另一种格式(例如 CSV)并导出到文件
  • 读取CSV等格式的文件并将内容转换为数据文件
  • 在 UI 中执行数据文件呈现的搜索和过滤

我遇到的问题与我在 MFC 中可以有多个 GUI 线程吗?中描述的问题类似。但是,我正在寻找一种通用方法,而不是该问题中的具体进度条更新。

我一直在尝试使用 Visual Studio 模板对实验性 MFC 应用程序进行简单测试,该模板在左侧停靠有一个树控件,以在工作线程中构建树。

如果我有一个CViewTree显示树视图的 MFC 窗口,我想从 C++11 线程更新该窗口,那么我当前正在使用它::PostMessage()来请求更新停靠窗格中的树控件。

如果我将 lambda 与全局一起使用,std::thread例如以下代码:

std::thread t1;

void CClassView::FillClassView()
{
    // ::SendMessage() seems to deadlock …
Run Code Online (Sandbox Code Playgroud)

mfc multithreading c++11 c++-winrt visual-studio-2017

5
推荐指数
1
解决办法
4986
查看次数

标签 统计

c++-winrt ×2

c++ ×1

c++11 ×1

mfc ×1

multithreading ×1

visual-studio-2017 ×1