Снимок рабочего стола

Материал из DRKB

Снимок рабочего стола[править | править код]

type
  TForm1 = class(TForm)
  public
    { Public declarations }
    procedure GrabScreen;
  end;

implementation
{$R *.DFM}

procedure TForm1.GrabScreen;
var
  DeskTopDC: HDc;
  DeskTopCanvas: TCanvas;
  DeskTopRect: TRect;
begin
  DeskTopDC := GetWindowDC(GetDeskTopWindow);
  DeskTopCanvas := TCanvas.Create;
  DeskTopCanvas.Handle := DeskTopDC;
  DeskTopRect := Rect(0, 0, Screen.Width, Screen.Height);
  Form1.Canvas.CopyRect(DeskTopRect, DeskTopCanvas, DeskTopRect);
  ReleaseDC(GetDeskTopWindow, DeskTopDC);
end;


procedure TForm1.Button1Click(Sender: TObject);
begin
  GrabScreen;
end;


Source: http://delphiworld.narod.ru/
ID: 01839