Re: TransparentBlt troubles...
Just a couple of things I noticed:
void TestView::OnDraw(CDC* dc)
{
TestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CDC dcMem;
dcMem.CreateCompatibleDC(dc);
********************************************************
//Remove this line, this is causing a resource leak! It is not even
necessary.
HDC hMemDC = CreateCompatibleDC(dcMem);
********************************************************
dc->SetBkColor(RGB(120,120,120));
********************************************************
//this dc doesn't seem to be used anywhere!
//remove this line also
CMemDC pDC(dc);
********************************************************
CRect rect;
GetClientRect(rect);
int B = 10;
int W = __min(rect.Width(), rect.Height());
W = (W - 2*B)/16;
CBitmap foo;
BITMAP bitMapInfo;
foo.LoadBitmap(IDB_EMPTY);
foo.GetBitmap(&bitMapInfo);
dcMem.SelectObject(foo);
********************************************************
//here just to be consistant I would use the CDC::TrasparentBlt
dc->TransparentBlt(100, 120, bitMapInfo.bmWidth,
bitMapInfo.bmHeight, &dcMem, 0, 0, bitMapInfo.bmWidth,
bitMapInfo.bmHeight, RGB (0, 128, 128));
********************************************************
}
AliR.