BitBlt ignores CAPTUREBLT and seems to always capture a cached copy of the target

后端 未结 2 1368
情话喂你
情话喂你 2020-12-20 16:47

I am trying to capture screenshots using the BitBlt function. However, every single time I capture a screenshot, the non-client area NEVER changes no matter what I do. It\'s

相关标签:
2条回答
  • 2020-12-20 17:22

    I capture all screen and obtains the same results... :(

    const uint SRCCOPY = 0x00CC0020; //SRCCOPY
        const uint CAPTUREBLT = 0x00CC0020 | 0x40000000; //CAPTUREBLT
    
        bool dv = BitBlt(hCaptureDC, 0, 0, Bounds.Width, Bounds.Height,
                 hDesktopDC, Bounds.Left, Bounds.Top, _with_tooltips ? CAPTUREBLT : SRCCOPY);
    
    0 讨论(0)
  • 2020-12-20 17:23

    Your confusion about BitBlt with CAPTUREBLT behaviour comes from the fact that official BitBlt documentation is unclear and misleading.

    It states that
    "CAPTUREBLT -- Includes any windows that are layered on top of your window in the resulting image. By default, the image only contains your window."

    What actually means (at least for any windows OS without Aero enabled) "CAPTUREBLT -- Includes any layered(!) windows (see WS_EX_LAYERED extended window style) that overlap your window. Non-layered windows that overlap your window is never included."

    Windows without WS_EX_LAYERED extended window style that overlap your window is not included with or without CAPTUREBLT flag (at least for any windows OS without Aero enabled).

    QT developers also misunderstood BitBlt/CAPTUREBLT documentation so QT documentation is actually wrong about QPixmap::grabWindow behaviour on WIN32 platform without Aero enabled.

    ADD:

    If you want to capture your window as it is on the screen you have to capture the entire desktop with CAPTUREBLT flag and then extract the rectangle with your window. (QT developers should do the same thing). It will work correctly in both cases: with and without Aero enabled/available.

    0 讨论(0)
提交回复
热议问题