All,

I am creating a memory device context and a bitmap using the following code:

CBitmap bitmap;
CBitmap* pOldBitmap;
CDC dcMemory;
dcMemory.CreateCompatibleDC(Givendc);
...