Einzelnen Beitrag anzeigen

Pascal95
(Gast)

n/a Beiträge
 
#3

Re: Bild-Inhalt der Zwischenablage abspeichern?

  Alt 23. Mär 2010, 20:27
Vielen Dank für die schnelle Antwort.

Jedoch habe ich den Sourcecode in mein Projekt kopiert und will ihn dann mit folgender Funktion aufrufen:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
  GetScreenShot(Image1);
end;
Ich weiß allerdings auch nicht genau, wie die Syntax aussehen soll, also wie ich die Prozedur aufrufen soll.

Außerdem gibt diese Prozedur:
Delphi-Quellcode:
procedure GetScreenShot (var ABitmap : TBitmap);
var
  DC : THandle;
begin
  if Assigned(ABitmap) then // Check Bitmap<>NIL
  begin
    DC := GetDC(); // Get Desktop DC
    try
      ABitmap.Width := Screen.Width; // Adjust Bitmapsize..
      ABitmap.Height := Screen.Height; // ..to screen size
      BitBlt(ABitmap.Canvas.Handle, // Copy
             0,0,Screen.Width,Screen.Height, // Desktop
             DC, // into
             0,0, // the
             SrcCopy // Bitmap
        );
    finally
      ReleaseDC(0, DC); // Relase DC
    end;
  end;
end;
... einige Errors:

unit1.pas(38,22) Error: Illegal parameter list
unit1.pas(40,11) Error: Wrong number of parameters specified for call to "GetDC"
unit1.pas(42,15) Error: Unknown record field identifier "WIDTH"
unit1.pas(43,15) Error: Unknown record field identifier "HEIGHT"
unit1.pas(44,22) Error: Unknown record field identifier "CANVAS"
unit1.pas(60,21) Error: Call by var for arg no. 1 has to match exactly: Got "TImage" expected "BITMAP"
unit1.pas(34,11) Hint: Found declaration: GetScreenShot(var BITMAP);
unit1.pas(88) Fatal: There were 6 errors compiling module, stopping

Warum funktioniert die Funktion nicht?
Das ist bei mir in der uses:
Delphi-Quellcode:
uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  ExtCtrls, StdCtrls, Windows, CLipBrd, LCLIntf, LCLType;
Liegt es daran, dass cih mit Lazarus arbeite?

Vielen Dank
Pascal
  Mit Zitat antworten Zitat