Solved

Deleting HBITMAP memory from GDI+ Bitmap

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
chcp 65001 File encoding 66 247
Visual Basic .Net - list of all values of runtime errors ("Err.Number" and "Err.Description") 6 86
Identify font 3 92
what font behind pdf 32 137
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 video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

773 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