cimage重绘有什么限制吗? 不能超过多少次?
while(dlg->m_bIsVideoRunning)
{
     dlg->m_capture.GetOneFrame();
     img = new CImage();
     img->Load(localpic);
     if (dlg->m_localv)
    {
        //////////循环重绘 5分钟左右程序就退出了,提示内存读取错误
img->Draw(dlg->GetDC()->m_hDC,dlg->m_localvrect.left ,dlg->m_localvrect.top,dlg->m_localvrect.Width()  , dlg->m_localvrect.Height() , 0, 0, 120, 90);
     }
     img->Destroy();
     delete img;
     img = NULL;     sleep(20);cimagedraw异常内存

解决方案 »

  1.   

    不建议在循环中,new CImage对象,把这段代码放到while上面吧.
      

  2.   

    new 放到外面还是崩溃,vs2008调试错误,显示到img->Draw(dlg->GetDC()->m_hDC,dlg->m_localvrect.left ,dlg->m_localvrect.top,dlg->m_localvrect.Width()  , dlg->m_localvrect.Height() , 0, 0, 120, 90);就崩溃了。cimage draw有问题吗?
      

  3.   

    img->Load(localpic);
       
    img->Destroy();为什么Destroy后内存还在不停的涨,没释放内存吗? 异常退出是不是内存不足啊?