0

I want to capture the global win32 output in Visual Studio 2012. I can do this with DebugView, but i would like to have this kind of output in a Visual Studio window. I can not just use the default Debug output, because i am developing SharePoint solutions and attaching to an other process doesn't work.

Is there a way to capture global win32 output in Visual Studio 2012 or is there an Add In out there, which captures this kind of output?

Edit:

Just to clarify: I use C# and i can write Debug-Output. I can't attach to the process and want to capture the global win32 debug output.

Alex H
  • 1,424
  • 1
  • 11
  • 25
  • DebugView does not display "global win32 output". It only displays strings passed to the OutputDebugString() winapi function. The general way to get text to appear in a debugger logging window. Only a debugger can display it, its WaitForDebugEvent() function call completes with the DEBUG_EVENT.dwDebugEventCode set to OUTPUT_DEBUG_STRING_EVENT. I suspect you'll be much ahead with the Trace class or a logging library like NLog. – Hans Passant Jul 29 '15 at 12:30
  • @HansPassant Thanks, but i cant change to an other Debug Solution atm. In other solutions i use the SharePoint intern ULS-Log and just use the normal Visual Studio-Debug tools, but in this solution i can't use them and have to use DebugView. – Alex H Jul 29 '15 at 12:38
  • Why can't you attach to other processes? – Thomas Weller Jul 29 '15 at 19:38
  • @ThomasWeller Idk. I get errors when i try it. – Alex H Jul 30 '15 at 06:41
  • What kind of errors? Please be a bit more verbose, we want to help you and need to understand the problem. – Thomas Weller Jul 30 '15 at 17:09
  • @ThomasWeller "Unable to start debugging on the web server." And when i try starting it the whole VS crashes. Because of this, and the fact i am working with multiple solutions at the same time, i wanted to get my debug output inside of VS. But it looks like there isn't such a feature i'm looking for. – Alex H Jul 31 '15 at 07:12

2 Answers2

0

Have you tried just using the following ...

OutputDebugString(str);

You could have this on a debug macro, I would use something similar when developing.

#if DEBUG_TO_VS2012 == 1
   #define DPRINTF( x ) OutputDebugString( x )
#else
   #define DPRINTF( X ) printf( x )
#endif

Hopefully this easy method helps.

Neil
  • 1,036
  • 9
  • 18
  • I use C#. But i think this is similar to Debug.WriteLine(string str);. The problem is, that i cant attach to the process outputting the strings. – Alex H Jul 29 '15 at 12:04
  • Let me look into it - ... Just thinking of easy options - have you tried directing the output to a file - and then just displaying that file in your c# app (update the read every second or so)..? – Neil Jul 29 '15 at 12:06
  • Try having a look here http://stackoverflow.com/questions/5005874/how-to-get-the-error-message-with-c-sharp - it might need a little changing Alex. – Neil Jul 29 '15 at 12:09
  • i can capture the debug output with DebugView, as i linked in the question. I just hoped there would be some kind of capture in Visual Studio, because reading stack traces without the code is annoying. I don't want to rewite the howl Application. – Alex H Jul 29 '15 at 12:11
  • thats not the kind of solution im looking for : /, but thanks for this idea. – Alex H Jul 29 '15 at 12:15
  • 1
    Try this - http://stackoverflow.com/questions/6938734/alternatives-to-debugview - it shows alternatives to debugView - this might at least guide you in the right direction. – Neil Jul 29 '15 at 13:40
0

Simple answer: there is currently no option to show this output inside of Visual Studio. When i find an AddOn i will update this answer.

Alex H
  • 1,424
  • 1
  • 11
  • 25