OutputDebugString with both WinDbg and DbgView

446 Views Asked by At

With DebugView is simple: I clear its output window with "DBGVIEWCLEAR" (in OutputDebugString, ODS), and then I show some 10 lines of info. I do this with a timer, 10 times per second.

But, while using WinDbg, DebugView doesn't get any output from ODS.

Q1: can WinDbg ignore / pass-through ODS, so that DebugView can catch it?

Or, maybe I could use WinDbg only: first, I'd have to setup .ocommand WINDBGCMD, then I could clear its output window with OutputDebugString("WINDBGCMD .cls;g");... but that fails with WinDbg telling me "Syntax error in ' .cls;g'".

Strange, but if I use OutputDebugString("WINDBGCMD .echo\"Hello\";g"); that works just fine.

Q2: how to clear the output window of WinDbg (using ODS)?

Q3: finally, it would be better if I could use WM_COPYDATA with some external APP that would be able to clear its output window and show my 10 lines of info - is there such an APP? Maybe TraceTool, but that looks complicated. Also, it looks as it requires C++, not C.

Note: before ODS, I used to simply TextOut on the desktop. That worked just fine, but visually interfered.

1

There are 1 best solutions below

0
On

I've solved my problem by using DebugView++

DebugView++ can receive debug string using SendMessage:

HWND debugviewpp = FindWindow(NULL, "[Capture Win32] - DebugView++");
SendMessage(debugviewpp, EM_REPLACESEL, GetCurrentProcessId(), (LPARAM) "Text 2 send");

Thus, WinDbg is out of the way.