我正在使用下面的代码通过bltblt捕获窗口的截图。 但是标题栏在捕获的截图中完全变成黑色。 我正在Windows 8.1上运行代码。 有没有办法正确地捕获标题栏。
// Retrieve the handle to a display device context for the sourceWindow
hdcScreen = GetDC(ss);
// Retrieve the handle to a display device context for the dest window
hdcWindow = GetDC(hWnd);
//Get the client area for size calculation
RECT rcClient;
GetWindowRect(ss, &rcClient);
if (!BitBlt(hdcWindow,
0, 0,
rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
hdcScreen,
0, 0,
SRCCOPY|CAPTUREBLT))
{
MessageBox(hWnd, L"BitBlt has failed", L"Failed", MB_OK);
goto done;
}
编辑: 我显示屏幕截图的窗口将覆盖整个桌面,并不断更新其后面窗口的截图。此外,显示屏幕截图的窗口始终是最顶部的窗口。