Smile Screen

Posted by ALB42 on 20. April 2015No Comments

Implemented Screenshot possiblity for AROS, works very nice. Also found a source, how to make a screenshot
without the windows, the application.Minimize and Restore was long time implemented already but I never tried.

so here the source to create a screenshot:


procedure TForm1.Button1Click(Sender: TObject);
var
  MyBitmap: TBitmap;
  ScreenDC: HDC;
  WrkJpg: TJpegImage;
begin
  Application.Minimize;
  Application.ProcessMessages;

  Sleep(32);

  MyBitmap := TBitmap.Create;
  ScreenDC := GetDC(0);
  MyBitmap.LoadFromDevice(ScreenDC);

  Application.Restore;
  Application.BringToFront;

  WrkJpg := TJpegImage.Create;
  try
    WrkJpg.CompressionQuality := 80;
    WrkJpg.Assign(MyBitmap);
    WrkJpg.SaveToFile('test.jpg');
  finally
    FreeAndNil(WrkJpg);
  end;
  ReleaseDC(0, ScreenDC);
  FreeAndNil(MyBitmap);
end;

and the resulting Image:
test

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.