Click here to Skip to main content
15,887,945 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am running an exe which makes use of a C++ dll and the dll outputs debug information. I can view the output info in the output window of Visual Studio. Can you suggest samples which implement listeners in C++ which can intercept this information and save it to a log file or a buffer. I do not want all the debugging data (for example exe has loaded/unloaded) but only the data that is output from this dll. Is there a way of doing it?
Posted

Here's an article that show you how to capture calls to OutputDebugString:

Mechanism of OutputDebugString[^]

Assuming that's what the DLL is calling, you should be able to make that code work for your purposes.
 
Share this answer
 
Comments
aravind3221 16-Aug-11 23:04pm    
The dll I have does not use OutputDebugString API but uses DbgPrintEx routine to do it though
TRK3 17-Aug-11 13:39pm    
Do need this for debugging on your machine?

Or are you trying to create a log file for post mortems in the field?

For debugging, you could try debugview:

http://technet.microsoft.com/en-us/sysinternals/bb896647

I haven't it used it myself, but it sounds like it will capture everything and you can specify filters to filter what it captures.

aravind3221 17-Aug-11 22:01pm    
Unfortunately DebugView is an old tool which captures DbgPrint and not the new version of the API.
I found a solution here thopugh:
http://www.debuginfo.com/examples/dbgexamples.html

Thanks for the help
This site has some useful resources
http://www.debuginfo.com/examples/dbgexamples.html
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900