You should try using the search function. I answered a very similar question to this not to long ago. Anyway here is some code that locks the screen, then copies the entire contents to memory, finally releases the screen:
Code:
HDC hdcScr, hdcMem;
HWND hwnd;
HBITMAP hBitmap;
If(LockWindowUpdate(hwnd = GetDesktopWindow())) {//locking the screen
hdcScr = GetDCEx(hwnd, NULL, DCX_CACHE | DCX_LOCKWINDOWUPDATE);
hdcMem = CreateCompatibleDC(hdcScr);
hBitmap = CreateCompatibleBitmap(hdcScr, 60, 60);
SelectObject(hdcMem, hBitmap);
BitBlt(hdcMem, 0, 0, 60, 60, hdcScr, 0, 0, SRCCOPY);
//whatever else you want to do
}
DeleteDC(hdcMem);
ReleaseDC(hwnd, hdcScr);
DeleteObject(hBitmap);
LockWindowUpdate(NULL); //unlock the screen