Autor Beitrag
CABALxx
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 174


D7 Ent
BeitragVerfasst: Fr 23.01.04 17:14 
hallo erstmal
ich will gleich am anfang sagen ich bin ein neuling was Delphi angeht ich hab das erst seit kurzem in Informatik und auch vorher noch nicht sooooo viel gemacht....also ist mein knowledge entsprechend klein......

ich will per Buttonklick einen screenshot machen und an einem bestimmten punkt speichern

bisheriger code:

.........

ausblenden volle Höhe 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:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
procedure GetScreenShot (var ABitmap : TBitmap);  
var  
  DC : THandle;  
begin  
  if Assigned(ABitmap) then                   
  begin  
    DC := GetDC(0);                         
    try  
      ABitmap.Width := Screen.Width;           
      ABitmap.Height := Screen.Height;         
      BitBlt(ABitmap.Canvas.Handle,            
             0,0,Screen.Width,Screen.Height,   
             DC,                               
             0,0,                              
             SrcCopy                           
        );  
    finally  
      ReleaseDC(0, DC);                        
    end;  
  end;  
end;



procedure TForm1.Button1Click(Sender: TObject);
var
  B : TBitmap;  
begin  
  B := TBitmap.Create;  
  try  
    GetScreenShot(B);
    Image1.Picture.Assign(B);
  finally  
    B.Free;  
  end;

end;

end.




wie man sieht hab ich den grössten teil aus einem tutorial übernommen
nun macht das Programm bei klick auf den Button1 einen screenshot und zeigt diesen in Image1 an. ich wollte jetzt mal fragen wie ich das machen muss, damit der screenshot in einem ordner / unter einem bestimmten Pfad gespeichert wird????

( ich hatte schon mal nachgeschaut wie man dateien von verzeichnissen in ander kopiert. das wäre kein problem aber ich hab ( als N00b ) ja keine ahnung von welchem Pfad ich den screen holen muss.......... )

sry falls es schon nen threat darüber gibt....

Moderiert von user profile iconMotzi: Delphi-Tags hinzugefügt


Zuletzt bearbeitet von CABALxx am Di 02.03.04 21:04, insgesamt 1-mal bearbeitet
Chatfix
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1583
Erhaltene Danke: 10

Win 10, Win 8, Win 7, Win Vista, Win XP
VB.net (VS 2015), MsSQL (T-SQL), HTML, CSS, PHP, MySQL
BeitragVerfasst: Fr 23.01.04 17:18 
:welcome: Such im Forum doch mal nach Suche in: Delphi-Forum, Delphi-Library SCREENSHOT. Da findest du sicher was!

_________________
Gehirn: ein Organ, mit dem wir denken, daß wir denken. - Ambrose Bierce
obbschtkuche
Gast
Erhaltene Danke: 1



BeitragVerfasst: Fr 23.01.04 17:26 
:welcome:

Den Code für das Screenshot hat er ja schon...

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
procedure TForm1.Button1Click(Sender: TObject);
var
 B : TBitmap;
begin
 B := TBitmap.Create;
 try 
  GetScreenShot(B); 
  B.SaveToFile('c:\pfad\dateiname.bmp'); // Speichert die Datei unter dem angegebenen Pfad ab.
 finally
  B.Free;
 end;
end;


Benutz am besten nächstesmal den [delphi]-Code
CABALxx Threadstarter
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 174


D7 Ent
BeitragVerfasst: Fr 23.01.04 18:00 
hey
danke danke
hat klasse funktioniert


:D :D :D :D
vielen dank
:o
FatalError
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

WIN ME
D6 Pers
BeitragVerfasst: Di 04.05.04 22:32 
Hi,

wenn ich den obersten Code in ein neues Formular implementiere(etwa so)...

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:
type
  TForm1 = class(TForm)
    Image1: TImage;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure GetScreenShot (var ABitmap : TBitmap);   //<==Marker
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure GetScreenShot (var ABitmap : TBitmap);
var   
  DC : THandle;   
begin   
  if Assigned(ABitmap) then                    
  begin


dann bekomme ich an der markierten Stelle eine Fehlermeldung:
Zitat:
[Error] Unit1.pas(14): Unsatisfied forward or external declaration: 'TForm1.GetScreenShot'


Was hab ich da vergessen? :?

Grüße
Andy :roll:
Motzi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2931

XP Prof, Vista Business
D6, D2k5-D2k7 je Prof
BeitragVerfasst: Di 04.05.04 23:25 
ausblenden Delphi-Quelltext
1:
procedure { --> }TForm1.{ <-- das da! }GetScreenShot (var ABitmap : TBitmap);					

_________________
gringo pussy cats - eef i see you i will pull your tail out by eets roots!
FatalError
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

WIN ME
D6 Pers
BeitragVerfasst: Do 06.05.04 14:23 
In der selben Zeile scheint noch ein Fehler zu liegen :roll: , jedenfalls bekomme ich <hier>


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    Image1: TImage;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
    procedure TForm1.GetScreenShot{genau hier}(var ABitmap : TBitmap);
  private
    { Private declarations }
  public
    { Public declarations }
  end;


den Fehler

Zitat:

Expected '=' but '(' found.
iKilledKenny
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 394
Erhaltene Danke: 8

Win XP
D5 Prof, C# Express 2005
BeitragVerfasst: Do 06.05.04 14:47 
du musst das TForm1. nicht in der interface section sondern in der implementation section vor deine function schreiben...

viele grüße
alex
FatalError
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 64

WIN ME
D6 Pers
BeitragVerfasst: Do 06.05.04 16:21 
Das ist es :D Vielen Dank euch beiden :D :D

Grüße
Andy :wink: