_
Ich denke, so ganz einfach ist das nicht. Wenn du einen Screenshot vom Desktop machst, diesen rot oder sonstwie einfärbst, und das Ergebnis dann wieder in den DC vom Desktop blittest, hast du beim nächsten Durchlauf das Problem, dass du einen Screenshot vom bereits veränderten Desktop machst. Vielleicht könnte man da was über einen 2. Desktop oder so machen, keine Ahnung...
Hier mal was schnell Dahingeschludertes zur Anregung (mit dem geschilderten Problem), vielleicht machst du ja was daraus:
int main(void)
{
// get desktop window (but can be any window)
HWND capture = GetDesktopWindow();
if(!IsWindow(capture)) {
return 1;
}
// get window dimensions
RECT rect;
GetWindowRect(capture, &rect);
size_t dx = rect.right - rect.left;
size_t dy = rect.bottom - rect.top;
// create BITMAPINFO structure
// used by CreateDIBSection
BITMAPINFO info;
info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
info.bmiHeader.biWidth = dx;
info.bmiHeader.biHeight = dy;
info.bmiHeader.biPlanes = 1;
info.bmiHeader.biBitCount = 24;
info.bmiHeader.biCompression = BI_RGB;
info.bmiHeader.biSizeImage = 0;
info.bmiHeader.biXPelsPerMeter = 0;
info.bmiHeader.biYPelsPerMeter = 0;
info.bmiHeader.biClrUsed = 0;
info.bmiHeader.biClrImportant = 0;
// a bitmap handle and a pointer its bit data
HBITMAP bitmap = 0;
BYTE* memory = 0;
for(;;) {
Sleep(50);
// create bitmap
HDC device = GetDC(capture);
bitmap = CreateDIBSection(device, &info, DIB_RGB_COLORS, (void**)&memory, 0, 0);
ReleaseDC(capture, device);
if(!bitmap || !memory) {
return 1;
}
// blit the contents of the desktop (winDC)
// to the bitmap (selected in memDC)
HDC winDC = GetWindowDC(capture);
HDC memDC = CreateCompatibleDC(winDC);
SelectObject(memDC, bitmap);
BitBlt(memDC, 0, 0, dx, dy, winDC, 0, 0, SRCCOPY);
for(int y=0;y<dy*3;y++) {
for(int x=0;x<dx;x+=3) {
memory[y*dx+x]|=0xff;
}
}
SelectObject(winDC, bitmap);
BitBlt(winDC, 0, 0, dx, dy, memDC, 0, 0, SRCCOPY);
DeleteDC(memDC);
ReleaseDC(capture, winDC);
DeleteObject(bitmap);
}
}