I am using bitblt to to capture a window. If the aero theme is enabled, The background of the captured image is black. If I disable the DWM and capture the window then the captured image is very good.
Here is part of my code.
HDC hdcMemDC = GDI32.INSTANCE.CreateCompatibleDC(desktopDC);
HDC windowDC = User32.INSTANCE.GetDC(window);
HWND window= User32Extra.INSTANCE.FindWindow(null, "Start menu");
GDI32Extra.INSTANCE.BitBlt(hdcMemDC, 0, 0, width, height, desktopDC, 0, 0, WinGDIExtra.SRCCOPY );
GDI32Extra.INSTANCE.BitBlt(hdcMemDC,windowBounds.left, windowBounds.top, windowWidth, windowHeight, windowDC, windowBounds.left+windowBounds1.right-windowBounds.right+(windowExtraGap/2), windowBounds.top+windowBounds1.bottom-windowBounds.bottom+(windowExtraGap/2), WinGDIExtra.SRCCOPY);
How to capture the start Menu with proper background?
Are there any other methods to get the proper image of aero window?
use desktop DC and cut to window
another variant
before call any capture method I call PrintWindow. It acts window to redraw itself. And as a result screen capture will have correct picture. The most stable result I got with double call of PrintWindow.