如果是Windows2000以后的GDI是分层的.可以用如下办法抓取.
procedure GetScreen(AfterWnd : HWND;img : TImage);
const
WS_EX_LAYERED = $00080000;
var
DC: HDC;
FStyle: Longint;
FCanvas: TCanvas;
bmpScreen : TBitmap;
R:TRect;
begin
AfterWnd := GetActiveWindow;
FStyle := GetWindowLong(AfterWnd, GWL_EXSTYLE);
FStyle := FStyle or WS_EX_LAYERED;
SetWindowLong(AfterWnd, GWL_EXSTYLE, FStyle);
Sleep(50);
bmpScreen := TBitmap.Create;
GetWindowRect(AfterWnd, R);
bmpScreen.Width := R.Right - R.Left;
bmpScreen.Height := R.Bottom - R.Top;
bmpScreen.Canvas.Lock;
DC := GetDC(0);
with bmpScreen do
Bitblt(Canvas.Handle, 0, 0,
R.Right - R.Left, R.Bottom - R.Top,
DC, R.Left, R.Top, SRCCOPY);
FStyle := GetWindowLong(AfterWnd, GWL_EXSTYLE);
FStyle := FStyle and (not WS_EX_LAYERED);
SetWindowLong(AfterWnd, GWL_EXSTYLE, FStyle);
img.Canvas.CopyRect(Rect(0,0,bmpScreen.Width,bmpScreen.Height),
bmpScreen.Canvas,
Rect(0,0,bmpScreen.Width, bmpScreen.Height));
ReleaseDC(0, DC);
bmpScreen.Canvas.UnLock;
bmpScreen.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
GetScreen(Self.Handle,Image1);
end;