Code:
HDC hdcc = CreateCompatibleDC(hdc);
//hdc - is your dc which you copy from
HBITMAP hBm = CreateCompatibleBitmap(hdc, iSrcW, iSrcH);
//iSrcW, iSrcH - size of you sourse hdc
HBITMAP hOldBm = (HBITMAP)SelectObject(hdcc, hBm);
BitBlt(hdcc, 0, 0, iSrcW, iSrcH, hdc, iX, iY, SRCCOPY);
// now, get info from copied bitmap
BITMAP bm;
memset(&bm, 0, sizeof BITMAP);
int iErr = GetObject(hBm, sizeof(BITMAP), &bm);
iErr = GetLastError();
iBPP = bm.bmBitsPixel;
DIBSECTION dis;
iErr = GetObject(hBm, sizeof(DIBSECTION), &dis);
int length = (bm.bmWidth * bm.bmHeight) * (bm.bmBitsPixel>>3);
if(0 == length)
return NULL;// nothing to do
// Ok, bitmap info now
BITMAPINFO bi;
memset(&bi, 0, sizeof BITMAPINFO);
BYTE *pBits = new BYTE[length];
bi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bi.bmiHeader.biWidth = bm.bmWidth;
bi.bmiHeader.biHeight = bm.bmHeight;
bi.bmiHeader.biPlanes = 1;
bi.bmiHeader.biBitCount = bm.bmPlanes * bm.bmBitsPixel;
bi.bmiHeader.biCompression = 0;
bi.bmiHeader.biSizeImage = 0;
bi.bmiHeader.biXPelsPerMeter = 0;
bi.bmiHeader.biYPelsPerMeter = 0;
bi.bmiHeader.biClrUsed = 0;
bi.bmiHeader.biClrImportant = 0;
LPBYTE lpBits = (LPBYTE) GlobalAlloc(GMEM_FIXED, length);
int iBits = GetDIBits(hdc, hBm, 0, bm.bmHeight, lpBits, &bi, DIB_RGB_COLORS);
//....... now you got bits of your pixels in lpBits
// remember, that y-axis begun from bottom of screen
// and don't forget:
GlobalFree(lpBits);
SelectObject(hdcc, hOldBm);
DeleteObject(hBm);
DeleteDC(hdcc);
Good luck!