I am trying to take a screenshot of my desktop (as you do with the printscreen button) but it is not working
I am trying to copy each pixel from the desktop onto a memory DC and then copy the bitmap from memory DC onto my window.
Here is the code:

Code:
PAINTSTRUCT ps, ps1;
	int x, y;
	HDC parenthdc, winhdc;
	HWND parenthwnd;
	HDC  memhdc;
	HBITMAP hbmp;
	BITMAP bm;

	//Create the bitmap
	winhdc = GetDC(hwnd);
	memhdc = CreateCompatibleDC(winhdc);
	hbmp = CreateCompatibleBitmap(memhdc, 1000,1000);
	ReleaseDC(hwnd, winhdc);

   switch(Message)
   {
   
   case WM_PAINT:
	   parenthwnd = GetParent(hwnd);
	   parenthdc = BeginPaint(parenthwnd, &ps);
	   //-----------------------
	   for(x=0;x<1000;x++)
	   {
		   for(y=0;y<1000;y++)
		   {
			   SetPixel(memhdc, x,y,GetPixel(parenthdc, x,y));
		   }
	   }
	   winhdc = BeginPaint(hwnd, &ps1);
	   BitBlt(winhdc, 0,0,1000,1000,memhdc,0,0,SRCCOPY);
	   EndPaint(hwnd, &ps1);
	   EndPaint(parenthwnd, &ps);
	   return 0;
Do you know why it is not putting the picture of desktop or is there any other method to get a screenshot of my desktop/