Solved

Deleting HBITMAP memory from GDI+ Bitmap

Posted on 2004-08-02
2
1,521 Views
Last Modified: 2013-12-03
Guys,

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:

LPSTR pDIB;
HBITMAP hbmp;

gdiBitmap->GetHBITMAP(NULL, &hbmp);
GetDIBits(*pDC, hbmp, 0, sizey, pDIB + sizeof(BITMAPCOREHEADER), (BITMAPINFO *)pDIB, DIB_RGB_COLORS));
DeleteObject(hbmp);

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.

regards,

Gordon.
0
Comment
Question by:jeffreyg
[X]
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
2 Comments
 

Author Comment

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

regards,

G.
0
 

Accepted Solution

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

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Industry Leaders: 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

In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
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…
Suggested Courses

632 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