Blog A simple blog based on Jekyll

Print ATL/MFC internal traces in Visual Studio 2012/2015/2017

Prior Visual Studio 2012, Microsoft provided a tool ATL/MFC Trace Tool to output trace messages in Visual Studio’s output debugging window.

ATLMFCTraceTool To use the ATL/MFC Trace Tool,

  • Open an MFC or an ATL project.
  • On the Debug menu, click Start Debugging.
  • On the Tools menu, click ATL/MFC Trace Tool.

However this tool is removed from VS2012, and missing atldebugapi.h if build from source.

I figured out that there is a major change in ATL/MFC after reading the source code. Add the following code in your code, e.g. CWinApp::InitInstance(), will enable full traces:

ATL::CTrace::SetCategories(ATL::CTrace::EnableAllCategories);
ATL::CTrace::SetLevel(ATL::CTrace::DisableTracing - 1);