HDC         hScrDC, hMemDC;         // screen DC and memory DC     
hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL);     
hMemDC = CreateCompatibleDC(hScrDC);      // get points of rectangle to grab  hBitmap = CreateCompatibleBitmap(hScrDC, nWidth, nHeight);      
// select new bitmap into memory DC     
   
hOldBitmap =   SelectObject (hMemDC, hBitmap);      
 // bitblt screen DC to memory DC     
BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);     
   
   // select old bitmap back into memory DC and get handle to     
   // bitmap of the screen          
   
 hBitmap = SelectObject(hMemDC, hOldBitmap);