CreateCompatibleBitmap causes resource leak 
Author Message
 CreateCompatibleBitmap causes resource leak

BoundCheck detected CreateCompatibleBitmap function caused resource
leak, please help! Thanks

void A::Update(*****)
{
   CPaintDC dc(this);                  
   CBitmap aBitmap;
   CBitmap aSizedBitmap;

   Resize(&dc, aBitmap, aSizedBitmap);

   aSizedBitmap.Detach();
   aSizedBitmap.DeleteObject();
   aBitmap.Detach();

Quote:
}

void A::Resize(CDC* pDC, CBitmap& SrcBitmap, CBitmap& DestBitmap)
{

    CDC dcMemSrc, dcMemDest;
    dcMemSrc.CreateCompatibleDC (pDC);
    dcMemDest.CreateCompatibleDC (pDC);

    CBitmap* pOldSrcBitmap = dcMemSrc.SelectObject (&SrcBitmap);
    dcMemSrc.SetMapMode (pDC->GetMapMode ());

    DestBitmap.CreateCompatibleBitmap(pDC, sizeDest.x, sizeDest.y);

    CBitmap* pOldDestBitmap = dcMemDest.SelectObject (&DestBitmap);
    dcMemDest.SetMapMode (pDC->GetMapMode ());

   dcMemDest.StretchBlt(org.x,org.y, sizeDest.x, sizeDest.y,
&dcMemSrc,   org.x,org.y, size.x, size.y, SRCCOPY);

    dcMemDest.SelectObject (pOldDestBitmap);
    dcMemSrc.SelectObject (pOldSrcBitmap);

    dcMemSrc.DeleteDC();
    dcMemDest.DeleteDC();

Quote:
}



Tue, 03 May 2005 05:53:41 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. ListView still causing GDI Resource Leak using CheckBoxes.

2. Memory Leaks/Resource Leaks

3. SR2 causes memory leak!???

4. ADO cause memory leak on EXCEL.

5. Win32API calls causing potentially memory leaks

6. Memory Leak caused?

7. Spliter bar causes memory leak! VB4

8. Database not available causing memory leak in vbscript

9. VBScript Function causes memory leak!

10. How to detect what is causing memory leak

11. Calling ActiveX exe causes leak - DESPERATE

12. Mapi control causes memory leak

 

 
Powered by phpBB® Forum Software