|
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.
|