Reputation: 5031
I have a c# windows service outputting the current date and time every second using Debug.WriteLine():
Debug.WriteLine(DateTime.Now);
I am then able to read this output using the SysInternals DebugView program (https://technet.microsoft.com/en-us/sysinternals/bb896647) however I want to basically recreate what I see in this tool in my own winforms application, therefore how can you programatically grab exactly the info DebugView is?
Upvotes: 2
Views: 2441
Reputation: 2702
Basically you want to intercept the debugging information coming from some process?
I think that this SO question might help you, but I don't know what is the current state of the MDbg.
I have a little program that does something like this, but I do it using interprocess communication with Named Pipes, so there is a 2-way communication involved.
You could also take a look at the Listeners property, which you can redirect the debug output to another stream, if it's somehow useful.
[Edit1]:
This SO thread tells you were to download the MDbg API so you can use it within .NET applications. Then the other link I posted might help you to actually get the output.
I think this problem can be tricky to solve, I solved it using NamedPipes but then both applications (the service and some other app) had to know about each other. Simply reading the Debug.Write of a process might involve some research about the MDbg.
Upvotes: 2