Reputation:
How do i remove or filter this kind of message?
This is very annoying and keeps displaying the whole time I cant understand why. Im using visual studio 2019 c++.
After reading this line of code:
MessageBox(g_hWnd, string.data(), L"", MB_OK | MB_ICONSTOP | MB_SETFOREGROUND | MB_APPLMODAL | MB_TOPMOST);
The message always is displayed:
windows\dwm\dwmapi\attribute.cpp(105)\dwmapi.dll!00007FFBE41B1940: (caller: 000000018000E820) LogHr(1) tid(83b8) 80070006 Identificador inválido.
But if I remove MB_ICONSTOP
and use only:
MessageBox(g_hWnd, string.data(), L"", MB_OK | MB_SETFOREGROUND | MB_APPLMODAL | MB_TOPMOST);
it does not display.
It is also displayed by other things that I didn't know.
Upvotes: 5
Views: 1394
Reputation:
I have added #include <Dwmapi.h>
and now it's not spamming that message in the debug console anymore.
https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/nf-dwmapi-dwmgetwindowattribute
I think the error was because it was not loading the lib dwamip.dll
.
Upvotes: 1
Reputation: 1899
This is an example of an XY Problem, also discussed here. Instead of trying to prevent the messages from being shown, it would be better to prevent them from being generated in the first place.
Judging by the links you posted, this problem has existed for a few years and has bothered many people. Fortunately your first link appears to have a workaround: the post by user "codeviewer" lists a function called suppress_dwmapi_output()
which when added to your code and called from InitInstance()
will apparently prevent these messages from being created.
Disclaimer: I haven't tried this myself.
Upvotes: 1