I've managed to achieve double buffering with GDI, but not with GDI+. I would like to display a png image without having it flicker. Furthermore, at some point I would also like to achieve animation with png images using GDI+, so knowing how to double buffer with GDI + is imperative.
I have managed to get a png image into an Image object, via an ISTREAM: Here is a portion of my code that will help you understand where I'm having trouble:
memmove(pBlock,pImage, size);
CreateStreamOnHGlobal(hBlock, FALSE, &pStream);
Graphics graphics(memDC);
Image image(pStream);
int image_width;
int image_height;
image_width= image.GetWidth();
image_height=image.GetHeight();
graphics.DrawImage(&image, posX,posY, image_width, image_height);
BitBlt(hdc, 0, 0, image_width, image_height, memDC, 0, 0, SRCCOPY);
Note: If I draw the png image directly to the screen DC (hdc), it renders fine. However, when I attempt to draw the image to a memDC first, and then blt that memDC to the screenDC, no image appears!
Can someone please point me in the right direction as to how someone is to double buffer with GDI plus? Thank you