捕获悬浮窗口
在进行屏幕捕获时,有些窗口的画面为什么捕获不了,比如,像迅雷的悬浮窗口。
[解决办法]
X雷的悬浮窗口,是一个分层窗口(半透明风格),捕获屏幕的时候,需要多加一个参数才行。
void __fastcall CrnCaptureScreenWithAlphaWnd(Graphics::TBitmap *bmp)
{
DWORD CAPTUREBLT1 = 0x40000000;
HDC hdcScreen = ::CreateDC("DISPLAY", NULL, NULL, NULL);
HDC hdcCompatible = ::CreateCompatibleDC(hdcScreen);
HBITMAP hbmpScreen = ::CreateCompatibleBitmap(hdcScreen,
GetDeviceCaps(hdcScreen, HORZRES),
GetDeviceCaps(hdcScreen, VERTRES));
::SelectObject(hdcCompatible, hScreen);
bmp->Handle = hbmpScreen ;
::BitBlt(hdcCompatible,
0, 0,
bmp->Width, bmp->Height,
hdcScreen,
0, 0,
SRCCOPY
[解决办法]
CAPTUREBLT1
);
::DeleteDC(hdcScreen);
::DeleteDC(hdcCompatible);
::DeleteObject(hbmpScreen);
}