Einzelnen Beitrag anzeigen

flashcoder

Registriert seit: 10. Nov 2013
83 Beiträge
 
#3

AW: MagSetWindowFilterList function not remove specified window of screenshot

  Alt 27. Jan 2018, 13:26
Delphi-Quellcode:
{ Here's how you can save the screen content into a bitmapfile.
  If you don't want to include the active (Delphi-)Application
  just put easily a 'Application.Minimize;' at the beginning
  of the procedure }


uses
  Windows, Graphics, Forms;

procedure TForm1.Button1Click(Sender: TObject);
var
  DC: HDC;
  Canvas: TCanvas;
  MyBitmap: TBitmap;
begin
  Canvas := TCanvas.Create;
  MyBitmap := TBitmap.Create;
  DC := GetDC(0);

  try
    Canvas.Handle := DC;
    with Screen do
    begin
      { detect the actual height and with of the screen }
      MyBitmap.Width := Width;
      MyBitmap.Height := Height;

      { copy the screen content to the bitmap }
      MyBitmap.Canvas.CopyRect(Rect(0, 0, Width, Height), Canvas,
                               Rect(0, 0, Width, Height));
      { stream the bitmap to disk }
      MyBitmap.SaveToFile('c:\windows\desktop\screen.bmp');
    end;

  finally
    { free memory }
    ReleaseDC(0, DC);
    MyBitmap.Free;
    Canvas.Free
  end;
end;
The main Form not must be minimized in my situation.
I really need of help to fix code that was posted on question.

Geändert von flashcoder (27. Jan 2018 um 13:28 Uhr)
  Mit Zitat antworten Zitat