MFC程序输出调试信息
1 CString str; 2 CPaintDC dc(this); 3 int cx = dc.GetDeviceCaps(HORZRES); 4 int cy = dc.GetDeviceCaps(VERTRES); 5 str.Format("%d %d", cx, cy); 6 AfxMessageBox(str);
1 CStringList list; 2 for (int i = 0; i < 10; i++) 3 list.AddTail(szSchools[i]); 4 POSITION pos = list.GetHeadPosition(); 5 while (pos != NULL) 6 { 7 CString string = list.GetNext(pos); 8 TRACE(TEXT("%s\n"), string); 9 } 10 return 0;
OutputDebugString("");
默认只能输出字符串,输入数字可以用下面方法:
#include <stdio.h>
char dbg[255] = {0};
sprintf(dbg, "Ver:%d\n", stScrollInfoVer.nPos);
OutputDebugString(dbg);