Autor Beitrag
neo
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179



BeitragVerfasst: Sa 13.12.03 19:02 
Hallo!
Ich habe schon vieles probiert, komme aber nicht drauf wie ich alle paar millisekunden einen screenshot machen kann.

Mit Timer hab ich schon probiert, und auch mir for schleife da bekomme ich viel zu wenig zusammen.

Kann mir wer helfen?
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 13.12.03 19:05 
Wie lange braucht er denn, um den Screenshot zu machen und zu speichern? Poste doch mal Code!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
neo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179



BeitragVerfasst: Sa 13.12.03 19:13 
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:
procedure ScreenToFile(aFileName: string);  
var  
  Bitmap: TBitmap;  
  JPG : TJPEGImage;  
  Canvas: TCanvas;  
begin  
  Canvas := TCanvas.Create;  
  try  
    Canvas.Handle := GetWindowDC(0);  
    try  
      Bitmap := TBitmap.Create;  
      JPG := TJPEGImage.Create;  
      try  
        Bitmap.Width := Screen.DesktopWidth;  
        Bitmap.Height:= Screen.DesktopHeight;  
        Bitmap.PixelFormat := pfDevice;  

        BitBlt(Bitmap.Canvas.Handle, 0, 0, Pred(Screen.DesktopWidth), Pred(  
            Screen.DesktopHeight), Canvas.Handle, Screen.DesktopLeft,  
            Screen.DesktopTop, Bitmap.Canvas.CopyMode);  

        JPG.Assign(Bitmap);  
        JPG.SaveToFile(aFileName);  
      finally  
        Bitmap.Free;  
        JPG.Free;  
      end;  
    finally  
      ReleaseDC(0, Canvas.Handle);  
    end;  
  finally  
    Canvas.Free;  
  end;  
end;


Moderiert von user profile iconPeter Lustig: Delphi-Tags hinzugefügt
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: Sa 13.12.03 19:29 
Hallo!

Ich kenne mich nicht so sehr mit dem Graifkkram aus, aber ein paar Ideen habe ich.

(1) Versuche mal als BMP zu speichern. Wenn Du Glück hast, dauert die Komprimierung zum JPG länger, als es dauert, die größere BMP-Datei zu speichern (glaube ich aber irgendwie nicht).

(2) (Luckie wird wahrscheinlich gleich sagen, waurm die Idee falsch ist, aber ich probiere es trotzdem mal): lagere das Speichern in eine Thread aus, dann kannst Du schon den nächsten ScreenShot machen, während noch gespeichert wird. Das kann für den Rechner und die Platte allerdings viel Arbeit werden. Und wie das mit dem Zugriff mehrerer Threads auf eine Resource aussieht, weiß ich auch nicht. Aber ich glaube, Luckie schrieb mal ein Tutorial dazu.

MfG
Peter

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: So 14.12.03 11:27 
boah mann mit bmps. hast du ne ahnung wie schnell da deine festplatte voll werden kann !!! huiuiui !!!

_________________
In the beginning was the word.
And the word was content-type: text/plain.
neo Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 179



BeitragVerfasst: So 14.12.03 12:03 
Titel: RE
Deswegen nehm ich auch JPG`s
Christian S.
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 20451
Erhaltene Danke: 2264

Win 10
C# (VS 2019)
BeitragVerfasst: So 14.12.03 12:38 
BMPs: naja, aber bei heutigen Festplatten ... Es dauert halt, dass JPEG erst zu komprimieren.

Aber das mit dem Thread solltest Du mal ausprobieren!

_________________
Zwei Worte werden Dir im Leben viele Türen öffnen - "ziehen" und "drücken".
umpani
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 389



BeitragVerfasst: So 14.12.03 12:39 
Wenn du jedes Bild direkt auf der HDD speicherst kann es sie klappen (egal ob mit JPG, oder BMP). Die HDD ist einfach zu langsam dafür. Du mußt dies Bilder erstmal alle im Speicher zwischenspeichern.

Aber JPG ist dafür nicht geeignet, da die Umwandlung vom BMP in JPG relativ langa dauert (auf jedenfall wenn man alle ms ein Bil machen will.

versuch mal ....savetostream (oderso).

Und nach den Aufnahmen speichere alle im stream abgespeicherten bilder auf die Festplatte.

_________________
Lernen, ohne zu denken, ist eitel; denken, ohne zu lernen, ist gefährlich. Konfuzius
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Mo 15.12.03 12:56 
nimm doch mal ein bild, dass genau so gross ist wie dein screen shot und mess die zeit, die benötigt wird, um das bild zu JPEGsieren. und dann miss mal die zeit die dein PC bruacht das alles auf die platte zu schreiben.

_________________
In the beginning was the word.
And the word was content-type: text/plain.
umpani
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 389



BeitragVerfasst: Mo 15.12.03 14:08 
Meinst du mich? ?!?

_________________
Lernen, ohne zu denken, ist eitel; denken, ohne zu lernen, ist gefährlich. Konfuzius
matze
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 4613
Erhaltene Danke: 24

XP home, prof
Delphi 2009 Prof,
BeitragVerfasst: Di 16.12.03 15:24 
ich meine den, der das machen will

_________________
In the beginning was the word.
And the word was content-type: text/plain.
Gandalfus
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 129



BeitragVerfasst: Di 16.12.03 16:06 
optimierungs Möglichkeiten:
Bild nur ein mal mit create erzeugen und nicht jedes mal wieder.
Vieleicht mal probieren 10 Bilder im Speicher zu sammeln und dann zusammen abzuspeichern.

_________________
Wennn man feststellt, dass es drei Moeglichkeiten gibt, die einen Vorgang schiefgehen lassen koennen und man diese ausschaltet, entstehen automatisch drei neue Moeglichkeiten.
blackbirdXXX

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: Fr 19.12.03 21:24 
:D Andere Möglichkeit. Du nimmst den TV Ausgang einer Karte stöpselst ihn beim Eingang an und machst Videoaufzeichnung.
So mach ich es immer wenn ich Videos von Programmen aufnehme.

_________________
Klein, schwarz und ärgert Techniker? Jumper!