Autor Beitrag
mexx2k
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 60



BeitragVerfasst: Sa 06.10.07 16:35 
Hallo !

Ich mache mit meinem Programm einen Screenshot vom Desktop. Allerdings muss ich meiner Funktion, welche den Screenshot macht, die Informationen mitgeben, wie groß sie den Screenshot machen soll.

Nur wie kann ich auslesen, wie groß der Desktop zu diesem Zeitpunkt ist?

Habe sowohl in diesem Forum als auch in anderen Foren gesucht, aber nichts gefunden, was mir weiterhilft.
Meine Funktion sieht so aus:

ausblenden 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:
function take_screenshot(): boolean;
var
  BMP: TBitmap;
  JPG: TJpegImage;
  Desktop: TCanvas;
  Width,Height,Left,Top : Integer;
begin
  Width := 500;
  Height := 500;
  Left := 10;
  Top := 10;

  BMP := TBitmap.Create;
  JPG := TJpegImage.Create;
  Desktop := TCanvas.Create;
  Desktop.Handle := GetWindowDC(GetDesktopWindow);
  BMP.Width := Width;
  BMP.Height := Height;
  BMP.Canvas.CopyRect(Rect(0, 0, Width - 1, Height - 1), Desktop, Rect(Left, Top, Left + Width, Top + Height));
  JPG.Assign(BMP);
  JPG.SaveToFile('C:\hehe.jpg');
  BMP.Free;
  JPG.Free;
  Desktop.Free;
end;
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 06.10.07 16:53 
Meinst du Screen.Width bzw. Screen.Height?
mexx2k Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 60



BeitragVerfasst: Sa 06.10.07 17:00 
ööhhm wenn das die höhe und breite der gesamten auflösung ist, dann ja ;)
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19346
Erhaltene Danke: 1754

W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Sa 06.10.07 17:09 
Ist es, ja. ;-)