现在的位置: 首页 > 综合 > 正文

Delphi取屏

2012年02月22日 ⁄ 综合 ⁄ 共 410字 ⁄ 字号 评论关闭

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;

抱歉!评论已关闭.