Autor Beitrag
DiamondDog
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Do 23.10.08 09:28 
Hallo Leute,
wie der Titel schon sagt möcht ich gerne einen Desktop Screenshot machen
und diesen auf meiner Form anzeigen.
Das ganze sollte so sein das wenn der Scrennshot gemacht wurde,
die Form ganz links oben in die Ecke kommt und dann der Screen ohne Rahmen der Form angezeigt wird.

Das hab ich dazu gefunden:
ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
function FormularScreenShot(Bmp: TBitmap; h : hWnd): Boolean;
var
  Rec: TRect;
  iWidth, iHeight: Integer;
begin
  with Bmp do try
    GetWindowRect(h, Rec);

    iWidth  := Rec.Right - Rec.Left;
    iHeight := Rec.Bottom - Rec.Top;

    Width := iWidth;
    Height := iHeight;

    BitBlt(Canvas.Handle, 0, 0, iWidth, iHeight, GetWindowDC(h), 0, 0, SRCCOPY);

    Result := True;
  finally
    ReleaseDC(h, GetWindowDC(h));
  end;
end;
{*************************************************************}

procedure TForm1.Button1Click(Sender: TObject);
var
  Bmp: TBitmap;
begin
  Bmp := TBitmap.Create;
  try
    FormularScreenShot(Bmp, Form1.Handle);
    Canvas.Draw(0, 0, Bmp);
  finally
    Bmp.Free;
  end;
end;
leider macht das aber nur einen Screen von meiner Form
und ich weiß nicht ganz wie ich es ändern muss das der gesamte Desctop genommen wird.

Danke schon mal fürs Helfen.

Mfg Dog
DeddyH
Ehemaliges Mitglied
Erhaltene Danke: 1



BeitragVerfasst: Do 23.10.08 09:33 
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var
  Bmp: TBitmap;
begin
  Bmp := TBitmap.Create;
  try
    FormularScreenShot(Bmp, GetDesktopWindow);
    Canvas.Draw(0, 0, Bmp);
  finally
    Bmp.Free;
  end;
end;
DiamondDog Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 460



BeitragVerfasst: Do 23.10.08 09:38 
Ahh so einfach.
1000 Dank.