c++ - 如何在visual studio上过滤调试输出窗口?

标签 c++ visual-studio visual-studio-2019

如何删除或过滤此类消息?
这很烦人,并且一直显示我不明白为什么。
我使用的是 Visual Studio 2019 C++。
Is safer to exit and terminate or stuck the code in a "fake" while loop?
When x condition doesn't meet i will
阅读这行代码后:MessageBox(g_hWnd, string.data(), L"", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND | MB_APPLMODAL | MB_TOPMOST);始终显示消息:

windows\dwm\dwmapi\attribute.cpp(105)\dwmapi.dll!00007FFBE41B1940: (caller: 000000018000E820) LogHr(1) tid(83b8) 80070006 Identificador inválido.
但是如果我删除 MB_ICONSTOP并且只使用:MessageBox(g_hWnd, string.data(), L"", MB_OK | MB_SETFOREGROUND | MB_APPLMODAL | MB_TOPMOST);它不显示。
它也被其他我不知道的东西显示出来。
一些谷歌:
https://social.msdn.microsoft.com/Forums/en-US/3a5a145a-c13d-4898-bb61-a5baadc9332f/why-am-i-getting-hundreds-of-weird-messages-in-debug-output-window?forum=vcgeneral
https://developercommunity.visualstudio.com/content/problem/258494/windowsdwmdwmapiattributecpp92dwmapidll72ed3cf4-ca.html

最佳答案

这是一个 XY Problem 的例子,还讨论了 here .与其试图阻止显示消息,不如首先阻止它们生成。
从你贴的链接来看,这个问题已经存在好几年了,困扰了很多人。幸运的是,您的第一个链接似乎有一个解决方法:用户“codeviewer”的帖子列出了一个名为 suppress_dwmapi_output() 的函数。当添加到您的代码并从 InitInstance() 调用时显然会阻止创建这些消息。
免责声明:我自己没有尝试过。

关于c++ - 如何在visual studio上过滤调试输出窗口?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66177458/

相关文章:

c# - 发生异常后向后单步执行程序 - Visual Studio

c++ - 将 Unicode 输出到控制台的最佳方法是什么?

c# - 还原 VS 2019 16.5.0 后找不到 Nuget 包

c++ - 对动态数组使用重载的 << 运算符

c++ - 将缓冲区与另一个缓冲区连接

c++ - 使用 C++ 的数组中出现次数最多的元素?

c# - 命名空间中的特殊字符

visual-studio - 有没有一个工具可以自动将make文件转换为sln/vcproj?

azure-devops - Azure Devops 管道在管道构建中出现 `default literal` 错误

c++ - 使用MS Visual Studio 2019 C++的Codeforce上的编译错误