I package this feature into two files, download this text to the local, saved to the correct file name. Implementing the source code without changing the source code, the debug version displays the debug information window, and does not realize the window in the Release version and does not increase the contractual burden. ############### DBWindow.h ################# / ************* *********************************************************** ***** creation date: 2004/08/30 file name: DBWindow.h author: Liu Lei (vietor) version: 2.0 E-mail: liuleilover@163.com create Objective: to use VC MFC / DLL programming usually requires Debug version The test information is output through the console, while the code to which the output debug information needs to be annotated when compiling into the Release version, and the courses are often troublesome. The role of this program is that the debug version can be debugged in a separate console window when the MFC / DLL software development is performed, and does not have to manually comment on the Release version, which is automatically carry out. Note: Only one console window is present within a process, for multiple DLLs that may simultaneously debug, use color identification. Copyright Notice: You can copy and use the copy of this program at will, but please ensure that all files are complete and not modified, if you have a modified opinion, please contact the author. *********************************************************** **************************** / #1fndef _dbwindow_ # define _dbwindow_ #include
The role of this program is that the debug version can be debugged in a separate console window when the MFC / DLL software development is performed, and does not have to manually comment on the Release version, which is automatically carry out. Note: Only one console window is present within a process, for multiple DLLs that may simultaneously debug, use color identification. Copyright Notice: You can copy and use the copy of this program at will, but please ensure that all files are complete and not modified, if you have a modified opinion, please contact the author.
*********************************************************** ***************************** / #include "stdafx.h" #include "dbwindow.h" #ifdef _debug #include
if (m_bAttrs) SetConsoleTextAttribute (m_hConsole, m_OldColorAttrs);} return ret;} ConsoleWindow ConWindow; #define MAX_BUF_LEN 4096 BOOL DBWindowTile (LPCTSTR tile) {return ConWindow.SetTile (tile);} BOOL DBWindowWrite (LPCTSTR fmt, ...) { TCHAR message [MAX_BUF_LEN]; va_list cur_arg; va_start (cur_arg, fmt); _vsntprintf (message, MAX_BUF_LEN, fmt, cur_arg); va_end (cur_arg); return ConWindow.WriteString (message);} BOOL DBWindowWrite (WORD Attrs, LPCTSTR fmt, ...) {TCHAR message [MAX_BUF_LEN]; va_list cur_arg; va_start (cur_arg, fmt); _vsntprintf (message, MAX_BUF_LEN, fmt, cur_arg); va_end (cur_arg); return ConWindow.WriteString (Attrs, message);} #endif Author Blog:
http://blog.9cbs.net/liuleilover/