procedure TForm1.CopyScreenToBmp(var Image:TImage);
var
Bmp:Tbitmap;
Canvas:TCanvas;
DC:HDC;
begin
Bmp := TBitmap.Create; //创建一个BITMAP来存放图象
Bmp.Width := screen.width; //设置图片大小与屏幕在小一致
Bmp.Height := screen.Height;
DC := GetDC (0); //取得屏幕的 DC
Canvas := TCanvas.Create; //创建一个CANVAS对象
Canvas.Handle := DC; //把句柄指向屏幕
//把整个屏幕复制到BITMAP中
Bmp.Canvas.CopyRect(Rect (0, 0, screen.Width, screen.Height),
Canvas,
Rect (0, 0, Screen.Width, Screen.Height));
Canvas.Free; //释放CANVAS对象
ReleaseDC (0, DC); //释放DC
Image.picture.Bitmap:=Bmp; //拷贝下的图象赋给IMAGE对象
Image.Width:=Bmp.Width; //设置Image的大小对捕捉到的图片大小一致
Image.Height:=Bmp.Height;
Bmp.free; //释放bitmap
end;