| 
 | 
 
void CClipTest2View :: OnDraw (CDC * pDC) 
{ 
CClipTest2Doc * pDoc = GetDocument (); 
ASSERT_VALID (pDoc); 
Ranch 
         // Get bitmap from clipboard 
HBITMAP hBmp = CCopyScr :: GetFromClip (this-> GetSafeHwnd ()); 
 
BITMAP bm; 
GetObject (hBmp, sizeof (BITMAP),&bm); 
 
CBitmap bmpDraw; 
bmpDraw.CreateBitmap (bm.bmWidth, bm.bmHeight, bm.bmPlanes, bm.bmBitsPixel, bm.bmBits); 
 
CDC memDC; // Define a compatible DC 
memDC.CreateCompatibleDC (pDC); // Create compatible DC 
 
CBitmap * pbmpOld = memDC.SelectObject (&bmpDraw); // Save the original DDB and select the new DDB into the DC 
pDC-> BitBlt (0, 0, bm.bmWidth, bm.bmHeight,&memDC, 0, 0, SRCCOPY); 
 
memDC.SelectObject (pbmpOld); // Selected into the original DDB 
} |   
 
 
 
 |