Deleting HBITMAP memory from GDI+ Bitmap
Posted on 2004-08-02
I am using the GDI+ libraries to load up images. I have loaded up the image into a Bitmap structure. I then need to get a handle to the HBITMAP so I used GetHBITMAP(). Then I get the DIB on this HBITMAP and then try to free the the HBITMAP .... in the following way:
GetDIBits(*pDC, hbmp, 0, sizey, pDIB + sizeof(BITMAPCOREHEADER), (BITMAPINFO *)pDIB, DIB_RGB_COLORS));
Now when I look at the memory usage my PF Usage in Windows Task Manager jumps up drastically when I get the HBITMAP and not by much when I GetDIBits(). But when I call DeleteObject on the HBITMAP it does not reduce the PF Usage by the same amount as the GetHBITMAP call increased it by.
Why is this. I can keep doing this or my app will explode soon.