I write a software that take screen shots from remote PCs but when the screen is displayed at my window the remote screen is distorted and i can't' view the remote screen! This is part of teh code of the client that capture remote screens:

BMPInfo.bmiHeader.biSize = sizeof(BITMAPINFO);
BMPInfo.bmiHeader.biWidth = Horz;
BMPInfo.bmiHeader.biHeight = Vert;

BMPInfo.bmiHeader.biBitCount = CPP;
BMPInfo.bmiHeader.biPlanes = BitPlanes;
BMPInfo.bmiHeader.biSizeImage = Horz * Vert * 4;
BMPInfo.bmiHeader.biCompression = BI_RGB;

BMPInfo.bmiHeader.biClrUsed = 24;
BMPInfo.bmiHeader.biClrImportant = 0;
HDC Mdc = GetDC(GetDlgItem(Spy,IDC_STATIC1));
HWND mDlg = GetDlgItem(Spy,IDC_STATIC1);
Mdc, // handle to DC
NULL, // x-coord of destination upper-left corner
NULL, // y-coord of destination upper-left corner
rect.right, // width of destination rectangle
rect.bottom, // height of destination rectangle
NULL, // x-coord of source upper-left corner
NULL, // y-coord of source upper-left corner
Horz, // width of source rectangle
Vert, // height of source rectangle
(CONST void *)BufOfPixels, // bitmap bits
&BMPInfo, // bitmap data
DIB_RGB_COLORS, // usage options
SRCCOPY // raster operation code
*** this code don't works??? Where is wrong???