CRgn rgn;
for(;;)
{
  rgn.CreatePolygonRgn...
  SetWindowRgn(rgn,true);
}
基本情况如上,需要在重新SetWindowRgn之前,释放掉原来的rgn,现在内存泄露极其快,一会就达到500M

解决方案 »

  1.   

    CRgn rgn;
    for(;;)
    {
      rgn.DeleteObject();
      rgn.CreatePolygonRgn...
      SetWindowRgn(rgn,true);
    }
      

  2.   

    试过了,不管用阿。好像由于将rgn绑定到window上,导致无法释放空间,郁闷
      

  3.   

    CRgn rgn;
    rgn.CreatePolygonRgn...
    for(;;)
    {
      SetRectRgn...
      SetWindowRgn(rgn,true);
    }
    rgn.DeleteObject();
      

  4.   

    After a successful call to SetWindowRgn, the system owns the region specified by the region handle hRgn. The system does not make a copy of the region. Thus, you should not make any further function calls with this region handle. In particular, do not delete this region handle. The system deletes the region handle when it no longer needed.