0

As always, apologies if this has been covered before.

I am writing a COM dll (Visual Studio 16.7.1, C++, ATL) to be used with VBA in Excel. I can use the OutputDebugString() function to output some salient info from my dll, but it gets lost in the deluge of debug information coming from Excel (exceptions, loading, unloading etc).

Is there a way I can chose not to see the debug info generated from Excel itself (maybe some check box in the debug properties)? I have played around with AllocConsole() to get a separate window to write to, but this seems to throw exceptions with both std::cout and printf(). (I am putting the AllocConsole() in the dllmain of the COM dll ... which might not be the right place ...).

I don't really want to write the debug info to a file as I want to watch the debug info as I step through my VBA code.

Thanks in advance for any pointers.

DS_London
  • 852
  • 1
  • 12

1 Answers1

0

Try TraceTool - it can capture OutputDebugString info and has a filter functionality.

Another approach would be to use a dedicated logging library (I've found spdlog good, but I definitely don't want to get into that debate) then set the library to flush the log file on every message. (In fact you could just write to a file with C++ streams then flush after each message, but using a proper library is a better long term solution). Then you just need to watch the tail of the log file. You can do this in various ways described here: A Windows equivalent of the Unix tail command or even with TraceTool!

stevecu
  • 116
  • 4