MFC GetBitmap Problem
The compiler gave no errors.
The image loads, but I get an assertion when I get to the line
bmp.GetBitmap(&bi);
The assertion mentions afxwin1.inl, Line 413.
What have I forgotten?
// CMyAppView message handlers
void CMyAppView::OnDip08H()
{
// TODO: Add your command handler code here
CString szFilename("toolbar.bmp");
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL,szFilename,
IMAGE_BITMAP,0,0,
LR_LOADFROMFILE|LR_CREATEDIBSECTION);
CBitmap bmp;
bmp.Attach(hBmp);
CClientDC dc(this);
CDC bmDC;
bmDC.CreateCompatibleDC(&dc);
CBitmap *pOldbmp = bmDC.SelectObject(&bmp);
BITMAP bi;
bmp.GetBitmap(&bi);
dc.BitBlt(0,0,bi.bmWidth,bi.bmHeight,&bmDC,0,0,SRCCOPY);
bmDC.SelectObject(pOldbmp);
}

