1, messagebox
2,trace.eg,TRACE("Hello World");参数字符串被输出到debug window中,不会影响程序执行。trace只对debug版有效。使trace生效的菜单选项:tools/MFC Tracer,enable tracing.
3,afxDump.字符串和数值都可以输出。eg,
afxDump << "Hello World " << i << endl; // i 是整數變數
vc中dump一个对象内容的标准方法。它的输出也是流向debug window。所以依然要确定程序是debug版。
4,如何在程序中决定自己是不是debug版。_DEBUG变数为TRUE,则为debug版。
eg:
#ifdef _DEBUG
afxDump << "Hello World" << i << "\n"; // i 是整數變數
#endif