Click here to get back home

custom CBitmap class

 HomeNewsGroups | Search | About
 microsoft.public.smartphone.developer    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
custom CBitmap class Lisa Pearlson 07-18-2005
Get Chitika Premium
Posted by Doug Forster on July 19, 2005, 4:09 pm
Please log in for more thread options
Hi Lisa,

> "Memory leak detected! Dumping object -> " or something would it say.

No not for either eVC products unfortunately, you are thinking of VS6. Its
easy to tell if you are leaking something as large as a bitmap though by
just test calling your method repeatedly and watching if memory usage
continues climbing

Cheers
Doug Forster




Posted by hansw77041 on October 6, 2005, 12:06 pm
Please log in for more thread options
Just a thought:
I you do GIF image files, this works... GIF files can be very small compared
to bmp, so there may be a space saving when using it as a resource in the exe
Best regards
Hans Wedemeyer

// from file. does not require the g_hInst
DoBitmap( your hdc, SHLoadImageFile ( LPCTSTR pszPathAndFileName ));

// from Resource
In the project.rc
IDG_MYIMAGE_GIF GIF DISCARDABLE "YourGifFileName.gif"

DoBitmap( your hdc, SHLoadImageResource ( HINSTANCE hinst, UINT uIdGif );

//////////////////////////////////////////////////////////////
void DoBitmap( HDC hdc, HBITMAP hbm )
{
HBITMAP hbmOld;
HDC hdcS = ::CreateCompatibleDC(hdcDst);
BITMAP bm;
        
GetObject(hbm, sizeof(bm),&bm);

hbmOld = (HBITMAP)::SelectObject(hdcS, hbm);
                                                
::BitBlt(hdc, 0, 0, bm.bmWidth, bm.bmHeight, hdcS, 0, 0, SRCCOPY);

::SelectObject(hdcS, hbmOld);
::DeleteDC(hdcS);
}

--


"Lisa Pearlson" wrote:

> In an effort to make it easier for me to work with bitmaps, without MFC or
> ATL, I created this class.
> Nothing spectacular, but I'm wondering if this leaks memory or needs
> improvement.



Similar ThreadsPosted
Class not registered May 14, 2008, 5:05 am
FileSystemWatcher class for NetFramework2 August 11, 2005, 12:52 am
Can’t override BACK key with Class Specified March 1, 2006, 7:32 pm
Class: method or internal procedure ??? May 17, 2007, 11:43 am
Re: Why does this Backlight turn on/off class not work on my device March 29, 2007, 7:57 am
Activate previous instance and delay/dialog class name December 13, 2005, 7:48 am
Using AlternateView class works for Windows Mobile but not Blackbe October 12, 2007, 3:46 pm
Custom Setup.dll July 6, 2005, 9:26 pm
launch custom.cpl.xml February 14, 2007, 4:13 pm
Custom ring tone June 5, 2005, 10:50 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap