Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Printing debug output in Windows programs

I am starting to do some work with the Windows API. However, I noticed that you can not use functions like printf if you have a windowed application. What is the standard way of printing debug and logging information? Sorry if this is an obvious question.

like image 506
Anne Nonimus Avatar asked Dec 28 '22 07:12

Anne Nonimus


2 Answers

I normally use OutputDebugString(), the API is here. While running the application you can then view the output of this function with DebugView from SysInternals or in the Visual Studio output window while debugging.

like image 98
linuxuser27 Avatar answered Jan 05 '23 16:01

linuxuser27


Options:

  1. Make your own class that logs to a file
  2. Create a list view or edit control, and append text to it
  3. Use OutputDebugString
  4. Create a console window
  5. Windows Event Tracing (not for general logging)
like image 32
Adrian McCarthy Avatar answered Jan 05 '23 15:01

Adrian McCarthy