文章目錄
- Windows 中輸出到DbgView中的函數實現:
Introduction
DebugView
is an application that lets you monitor debug output on your local system, or any computer on the network that you can reach via TCP/IP. It is capable of displaying both kernel-mode and Win32 debug output, so you don't need a debugger to catch the debug output your applications or device drivers generate, nor do you need to modify your applications or drivers to use non-standard debug output APIs.
DebugView Capture
Under Windows 2000, XP, Server 2003 and Vista DebugView
will capture:
- Win32 OutputDebugString
- Kernel-mode DbgPrint
- All kernel-mode variants of DbgPrint
implemented in Windows XP and Server 2003
DebugView
also extracts kernel-mode debug output generated before a crash from Window's 2000/XP crash dump files ifDebugView
was capturing at the time of the crash.
Installation and Use
Simply execute the DebugView
program file (dbgview.exe) andDebugView
will immediately start capturing debug output. Note that if you run DebugView
on Windows 2000/XP you must have administrative privilege to view kernel-mode debug output. Menus, hot-keys, or toolbar buttons can be used to clear the window, save the monitored data to a file, search output, change the window font, and more. The on-line help describes all of DebugView
's features.
Windows 中輸出到DbgView中的函數實現:
在進行Windows開發中,大家經常需要將自己程式的運行時資訊輸出到一個調試視窗中,讓系統的調試著可以隨時監控程式的實際運行狀態,如下的函 數可以將程式運行時資料輸出到DbgView中(DbgView由Sysinternals開發,該公司已被微軟收購),並且調用工具直接查看輸出值;
void DEBUG_PRINT(IN TCHAR *format, ...)
{
va_list argList;
TCHAR szFormat[256], szContent[1024]; //maximum buffer is 1K bytes
_stprintf(szFormat, TEXT(" %s"), format);
va_start(argList, format);
_vsnwprintf(szContent, 1024, szFormat, argList);
va_end(argList);
lstrcat(szContent, L"/n");
OutputDebugString(szContent);
}
http://download.sysinternals.com/Files/DebugView.zip