somewhere you have to have a memdc
Code:
CDC* pActiveDC;
CDC memdc;
CBitmap bmp;
void MyClassDlg::LoadBmp()
{
CDC* pdc = GetDC();
memdc.CreateCompatibleDC( pdc );
bmp.LoadBitmap( IDB_BITMAP1 );
memdc.SelectObject( &bmp );
}
//** Windos paint message handler
void MyClassDlg::OnPaint()
{
.......
CDC* pdc = GetDC();
BITMAP b;
bmp.GetBitmap( &b );
pActiveDC = &memdc; //not needed but allows for selection from multiple memdcs available
pdc->BitBlit( x, y, b.bmWidth, b.bmHeight, pActiveDC, 0, 0, SRCCOPY);
//where x, y are the coordinates on the dialog where the bitmap will be positioned
}
if you are not using the MFC you will need to use
HDC
BITMAP
and the GetDC(....)
CreateCompatibleDC(...)
LoadBitmap(....)
api calls
the concept is the same though...
to load from a file you will need the MAKEINTRESOURCE macro....