尝试编译以下代码:
#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++/CX 和 ++/WinRT 开发简单的 UWP 应用程序后,我开始享受针对该环境进行 Windows UI 应用程序开发的一些功能。
现在必须回到更熟悉的 MFC 应用程序开发,我想将我的方法更改为类似于 UWP 应用程序开发的方法。其想法是使用异步 C++11 线程生成内容并修改 MFC UI 中显示的内容。
我想要做的主要更改是使用 C++11 线程来卸载一些耗时的任务,并使这些线程将结果传达回主 MFC UI。
我希望卸载到 C++11 线程上的一些任务(与我在 UWP 应用中使用 C++/CX 和 C++/WinRT 的异步任务使用的任务类似)是:
我遇到的问题与我在 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)