Registriert seit: 8. Mai 2005
Ort: Sondershausen
4.274 Beiträge
Delphi 6 Personal
|
Re: Desktop bild erstellen
17. Dez 2005, 06:25
Ein Beispiel:
Delphi-Quellcode:
uses JPEG;
procedure TForm1.Button1Click(Sender: TObject);
const
FileName = '.\screen.jpg';
JpgQuality = 98; // 1..100
var
DeskHdC : Longint;
JpgImg: TJPEGImage;
BmpImg: TBitmap;
begin
JpgImg := TJPEGImage.Create;
BmpImg := TBitmap.Create;
try
DeskHdc := GetDC(GetDesktopWindow);
BmpImg.Height := Screen.Height;
BmpImg.Width := Screen.Width;
BitBlt(BmpImg.Canvas.Handle,
0,
0,
Screen.Width,
Screen.Height,
DeskHdc,
0,
0,
SRCCOPY);
JpgImg.Assign(BmpImg);
if FileExists(FileName) then DeleteFile(FileName);
JpgImg.CompressionQuality := JpgQuality;
JpgImg.SaveToFile(FileName);
//Previewimage
Image1.Picture.Assign(BmpImg);
finally
JpgImg.Free;
BmpImg.Free;
end;
end;
|
|
Zitat
|