Windows程序调试
//不以窗口显示断言
void  CMyView::OnDraw (CDC* pDC)
{
 int previousReportMode = _CrtSetReportMode(_CRT_ASSERT, 
         _CRTDBG_MODE_DEBUG);
 
 //可用_CrtSetReportFile
 CMyDoc* pDoc = GetDocument();
 ASSERT_VALID(pDoc);
 if( previousReportMode != -1 )
  _CrtSetReportMode(_CRT_ASSERT, 
         previousReportMode);
 
}
//这种方法让你不用打扰窗口画图就可以在出现窗口后,随时察看导致断占失效的代码
//转储到文件
#ifdef _DEBUG
CFile dumpFile
dumpFile.Open(_T('dump.log', CFile::modeWrite | CFile::modeCreate));
afxDump.m_pFile = &dumpFile
#endif
 
                    
                     
                    
                 
                    
                 
                
            
         
         
 浙公网安备 33010602011771号
浙公网安备 33010602011771号