Salut a tous,
voila je voudrais recuperer une capture d'ecran (ca j'ai reussi).
Ensuite je voudrais l'afficher sur le fond de ma fenetre, mais pas d'un coups, mais pixel par pixel.
Voila mon code, il m'affiche que du noir :
void Capture_Screen(HDC hdest)
{
HDC hDC;
SIZE size;
BITMAPINFO myBIT;
HBITMAP myBitmap;
UINT *pixel;
int x;
int y;
hDC = GetDC(NULL);
size.cx = GetSystemMetrics(SM_CXSCREEN);
size.cy = GetSystemMetrics(SM_CYSCREEN);
memset(&myBIT,0,sizeof(myBIT));
myBIT.bmiHeader.biSize=sizeof(BITMAPINFOHEADER);
myBIT.bmiHeader.biWidth=size.cx;
myBIT.bmiHeader.biHeight=size.cy;
myBIT.bmiHeader.biPlanes=1;
myBIT.bmiHeader.biBitCount=8;
myBitmap = CreateDIBSection(hDC, &myBIT, DIB_PAL_COLORS, (void **)&pixel, NULL, 0);
if (myBitmap)
{
for (y = 1; y < size.cy; y++)
for (x = 1; x < size.cx; x++)
SetPixel(hdest, x, y, COLORREF2RGB(pixel[x*y]));
}
else
MessageBox(NULL, "Can't create DIB Section", "error", MB_OK);
DeleteObject(myBitmap);
DeleteDC(hDC);
ReleaseDC(NULL, hDC);
}
Si quelqu'un a une idee .... d'avance merci.
Arno