Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Deleting HBITMAP memory from GDI+ Bitmap

Posted on 2004-08-02
Medium Priority
Last Modified: 2013-12-03

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:


gdiBitmap->GetHBITMAP(NULL, &hbmp);
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.


Question by:jeffreyg
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 11702165
I got it myself. It was nothing to do with deleting the object HBITMAP but deleteing the Bitmap structure afterwards.



Accepted Solution

modulo earned 0 total points
ID: 11702265
Closed, 75 points refunded.

Community Support Moderator
Experts Exchange

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following diagram presents a diamond class hierarchy: As depicted, diamond inheritance denotes when two classes (e.g., CDerived1 and CDerived2), separately extending a common base class (e.g., CBase), are sub classed simultaneously by a fourt…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question