這個工具需要下載安裝, 在進行程序調試時,是很方便的一個助手。
下面分別列出在c++和c#中使用什麼命令去打印字符串,會在DebugView中輸出顯示。
C++中需要寫的代碼:
用OutputDebugString輸出你想要的信息,需要引用頭文件windowl.h
下面是我代碼中用到的:
#include <atlstr.h> // 該頭文件包含了對windows.h的引用
CStringA str; str.Format("m_entrefGroupMap.size = %u", m_displayGroupMap.size()); OutputDebugStringA(str); 庫函數中的定義:
void WINAPI OutputDebugString(
_In_opt_ LPCTSTR lpOutputString);
C#中需要寫的代碼:
Debug.WriteLine
System.Diagnostics.Debug.WriteLine("Enter ViewViewModel!");