Delphi取屏
var
canvas: TCanvas;
bmp:TBitmap;
dwh:hWnd;
dwd:HDC;
begin
dwh:=GetDesktopWindow;
dwd:=GetWindowDC(dwh);
canvas:=TCanvas.Create;
try
canvas.Handle:=dwd;
bmp:=TBitmap.Create;
try
bmp.Width := Screen.Width;
bmp.Height := Screen.Height;
bmp.Canvas.CopyRect(bmp.Canvas.ClipRect,canvas,bmp.Canvas.ClipRect);
bmp.SaveToFile('f:\a.bmp');
finally
bmp.Free;
end;
finally
canvas.Free;
end;
end;