From MSDN
BitBlt returns an error if the source and destination device contexts represent different devices. To transfer data between DCs for different devices, convert the memory bitmap to a DIB by calling GetDIBits. To display the DIB to the second device, call SetDIBits or StretchDIBits.
What does this mean? In short, mixing DWM (i.e. Aero) and non-GDI applications (OpenGL, for example) makes BiBlt a unpredictable/unreliable.
Again from MSDN:
The desktop composition feature, introduced in Windows Vista, fundamentally changed the way applications display pixels on the screen. When desktop composition is enabled, individual windows no longer draw directly to the screen or primary display device as they did in previous versions of Windows. Instead, their drawing is redirected to off-screen surfaces in video memory, which are then rendered into a desktop image and presented on the display.
Since blitting with the DWM has these know issues, you may:
try to use alternative techniques; you have a nice list here
you may disable DWM (temporarly) using
DwmEnableComposition(DWM_EC_DISABLECOMPOSITION);
Try and see if any works for you.
AFAIK however, the only way to reliably get the content of an application which uses 3D rendering (DirectX or OpenGL) is to is to inject yourself into the process and copy out the bits (see this answer for DirectX, or hook wglSwapBuffers
and do a readback with glReadPixels
for OpenGL)