Solved

Deleting HBITMAP memory from GDI+ Bitmap

Posted on 2004-08-02
2
1,484 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
2 Comments
 

Author Comment

by:jeffreyg
Comment Utility
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
Comment Utility
Closed, 75 points refunded.

modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

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…
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…
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…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

763 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now