J'avais rien a faire donc j'ai fait ca pour toi mais j'ai pas tester j'espère que ca marche :P
void Printscreen(char* szPath)
{
RECT r;
DWORD OL;
HDC dc;
COLORREF cr;
GetClientRect(hMainWnd,&r);
dc = GetDC(hMainWnd);
BITMAPFILEHEADER bfh;
BITMAPINFOHEADER bih;
RGBQUAD rgb;
bfh.bfType = 19778;
bfh.bfReserved1 = 0;
bfh.bfReserved2 = 0;
bfh.bfSize = 54 + ( r.right-r.left * r.bottom-r.top * 32 );
bfh.bfOffBits = 54;
bih.biSize = sizeof(BITMAPINFOHEADER);
bih.biHeight = r.bottom - r.top ;
bih.biWidth = r.right - r.left ;
bih.biPlanes = 0;
bih.biBitCount = 32;
bih.biClrImportant = 0;
bih.biClrUsed = 0;
bih.biCompression = 0;
bih.biSizeImage = 0;
bih.biXPelsPerMeter = 0;
bih.biYPelsPerMeter = 0;
HANDLE hFile = CreateFile(szPath,GENERIC_WRITE,0,0,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,0);
if ( hFile == INVALID_HANDLE_VALUE )
{
::MessageBox(0,"Impossible de créer le fichier",0,0);
return;
}
WriteFile(hFile,&bfh,sizeof(BITMAPFILEHEADER),&OL,0);
WriteFile(hFile,&bih,sizeof(BITMAPINFOHEADER),&OL,0);
for ( int i = 0 ; i < r.bottom - r.top ; i++ )
{
for ( int j = 0 ; j < r.right - r.left ; j++ )
{
cr = GetPixel(dc,r.left+j,r.bottom-i);
rgb.rgbRed = GetRValue(cr);
rgb.rgbGreen = GetGValue(cr);
rgb.rgbBlue = GetBValue(cr);
rgb.rgbReserved = 0;
WriteFile(hFile,&rgb,sizeof(RGBQUAD),&OL,0);
}
}
CloseHandle(hFile);
}
Ah et puisque tu est en MFC tu n'a qu'a changer hMainWnd pour this .. ca devrais marcher ...

________________________________________________________________________
Hardware is what we play with until it breaks, Software is what we play with until it works !
