AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Programmierung allgemein Multimedia Delphi Bei druck auf "Druck" bild erstellen. Programm dreht durch
Thema durchsuchen
Ansicht
Themen-Optionen

Bei druck auf "Druck" bild erstellen. Programm dreht durch

Ein Thema von Assun · begonnen am 14. Apr 2005 · letzter Beitrag vom 15. Apr 2005
Antwort Antwort
Seite 1 von 2  1 2      
Benutzerbild von Assun
Assun

Registriert seit: 3. Feb 2005
Ort: Hilzingen am Bodensee
469 Beiträge
 
Delphi 2005 Personal
 
#1

Bei druck auf "Druck" bild erstellen. Programm dre

  Alt 14. Apr 2005, 15:40
hi ! ich schreibe ein Programm, das regelmäßig überptüft, ob ein Bitmap in der Zwischenablage liegt und diese dann sofort als JPEG/GIF/PNG oder BMP speichert. ich benutze diese Methode : (es soll ein Bild gespeichert werden, sobald man auf "Druck" drückt.

Delphi-Quellcode:
procedure TMainfrm.Timer1Timer(Sender: TObject);
Var Bildname : String;
begin
Bildname := IntToStr(i);
// Dem Programm genügend Zeit lassen...
Timer1.Enabled := False;
// Nun folgen die If-Blöcke :

// Wenn ein Bitmap im ClipBoard liegt dann......
if Clipboard.HasFormat(CF_BITMAP) then begin
// ...erhöhe i um den Wert 1 und schreibe den Wert in eine Ini File
inc(i);
// Ini File wird geladen
with TIniFile.Create(ExtractFilePath(ParamStr(0)) + 'Settings/data.ini') do
   try
   WriteInteger('Bildanzahl','Anzahl',i);
   finally
   //Ini wird freigegeben
   Free;
if JPEGRadio.Checked = True then SaveAsJpeg(Bildname + '.jpg',TrackBar1.Position)
else if BMPRadio.Checked = True then SaveAsBmp (Bildname + '.bmp')
else if PNGRadio.Checked = True then SaveAsPNG (Bildname + '.png')
else if GIFRadio.Checked = True then SaveAsGif (Bildname + '.GIF')
end
end;
sleep(200);
ClipBoard.Free;
Timer1.Enabled := True;
end;
wenn ich diesen Code jedoch verwende, werden pro sekunde ca. 30 Bilder erzeugt !!! und mein PC stürzt, wie sich jeder denken kann dabei fast ab !

Was mache ich falsch ?

Gibt es vielleicht noch einen anderen Weg, dies zu lösen ?

vielen Dank,

Euer Assun
Sebastian Dietrich
http://Assun.de - bald komplett überarbeitet
  Mit Zitat antworten Zitat
Benutzerbild von Ultimator
Ultimator

Registriert seit: 17. Feb 2004
Ort: Coburg
1.860 Beiträge
 
FreePascal / Lazarus
 
#2

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 14. Apr 2005, 15:55
Eigentlich klar, denn das Bild in der ZWischenablage ist da ja immernoch, auch wenn du das Bild schon gespeichert hast
Julian J. Pracht
  Mit Zitat antworten Zitat
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#3

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 14. Apr 2005, 15:58
Mit ClipBoard.Open sorgst du dafür, dass die Zwischenablage nicht verändert wird, während du sie verarbeitest.

Und mit ClipBoard.Clear löschst du den Inhalt, den du als Datei weggeschrieben hast, damit du ihn das nächste mal nicht wieder wegschreibst.

ClipBoard.Free sollte der aufrufen, der vorher TClipBoard.Create aufgerufen hat - das warst nicht du, oder?

Die Zählvariable musst du eigentlich nur zu Beginn deines Programms lesen und beim Verlassen speichern.

Und an Stelle des Timers ist die Überwachung einer systemweiten Nachricht eleganter.

Aber sonst gefällt mir dein Programm schon ganz gut - ehrlich.
  Mit Zitat antworten Zitat
Benutzerbild von Assun
Assun

Registriert seit: 3. Feb 2005
Ort: Hilzingen am Bodensee
469 Beiträge
 
Delphi 2005 Personal
 
#4

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 14. Apr 2005, 16:03
oh, ja es sollte auch ClipBoard.Clear heissen...war nur ein Schreibfehler.

Aber selbst wenn ich den Inhalt lösche : es werden trotdem so viele Bilder produziert !

@marabu hmmm ich habe keine Ahnung wie ich das mit den Systemnachrichten machen soll....hast du ne idee ?
Sebastian Dietrich
http://Assun.de - bald komplett überarbeitet
  Mit Zitat antworten Zitat
Benutzerbild von Ultimator
Ultimator

Registriert seit: 17. Feb 2004
Ort: Coburg
1.860 Beiträge
 
FreePascal / Lazarus
 
#5

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 14. Apr 2005, 16:10
Hier hab ich mal aus der PSDK-Hilfe was zum Thema "Clipboard" gesucht :
Code:
Clipboard

--------------------------------------------------------------------------------

The clipboard is a set of functions and messages that enable applications to transfer data. Because all applications have access to the clipboard, data can be easily transferred between applications or within an application.

This overview does not describe how to copy and paste linked or embedded objects. For information on these subjects, see the Component Object Model (COM) documentation.


Overviews
About the Clipboard
This section discusses the clipboard.

Clipboard Formats
A window can place more than one object on the clipboard, each representing the same information in a different clipboard format. Users need not be aware of the clipboard formats used for an object on the clipboard.

Clipboard Operations
A window should use the clipboard when cutting, copying, or pasting data. A window places data on the clipboard for cut and copy operations and retrieves data from the clipboard for paste operations.

HTML Clipboard Format
This section discusses the HTML Clipboard format.

Using the Clipboard
A clipboard viewer window displays the current content of the clipboard, and receives messages when the clipboard content changes.



Functions
ChangeClipboardChain
The ChangeClipboardChain function removes a specified window from the chain of clipboard viewers.

CloseClipboard
The CloseClipboard function closes the clipboard.

CountClipboardFormats
The CountClipboardFormats function retrieves the number of different data formats currently on the clipboard.

EmptyClipboard
The EmptyClipboard function empties the clipboard and frees handles to data in the clipboard. The function then assigns ownership of the clipboard to the window that currently has the clipboard open.

EnumClipboardFormats
The EnumClipboardFormats function enumerates the data formats currently available on the clipboard.

Clipboard data formats are stored in an ordered list. To perform an enumeration of clipboard data formats, you make a series of calls to the EnumClipboardFormats function. For each call, the format parameter specifies an available clipboard format, and the function returns the next available clipboard format.


GetClipboardData
The GetClipboardData function retrieves data from the clipboard in a specified format. The clipboard must have been opened previously.

GetClipboardFormatName
The GetClipboardFormatName function retrieves from the clipboard the name of the specified registered format. The function copies the name to the specified buffer.

GetClipboardOwner
The GetClipboardOwner function retrieves the window handle of the current owner of the clipboard.

GetClipboardSequenceNumber
The GetClipboardSequenceNumber function retrieves the clipboard sequence number for the current window station.

GetClipboardViewer
The GetClipboardViewer function retrieves the handle to the first window in the clipboard viewer chain.

GetOpenClipboardWindow
The GetOpenClipboardWindow function retrieves the handle to the window that currently has the clipboard open.

GetPriorityClipboardFormat
The GetPriorityClipboardFormat function retrieves the first available clipboard format in the specified list.

IsClipboardFormatAvailable
The IsClipboardFormatAvailable function determines whether the clipboard contains data in the specified format.

OpenClipboard
The OpenClipboard function opens the clipboard for examination and prevents other applications from modifying the clipboard content.

RegisterClipboardFormat
The RegisterClipboardFormat function registers a new clipboard format. This format can then be used as a valid clipboard format.

SetClipboardData
The SetClipboardData function places data on the clipboard in a specified clipboard format. The window must be the current clipboard owner, and the application must have called the OpenClipboard function. (When responding to the WM_RENDERFORMAT and WM_RENDERALLFORMATS messages, the clipboard owner must not call OpenClipboard before calling SetClipboardData.)

SetClipboardViewer
The SetClipboardViewer function adds the specified window to the chain of clipboard viewers. Clipboard viewer windows receive a WM_DRAWCLIPBOARD message whenever the content of the clipboard changes.



Messages
WM_CLEAR
An application sends a WM_CLEAR message to an edit control or combo box to delete (clear) the current selection, if any, from the edit control.

WM_COPY
An application sends the WM_COPY message to an edit control or combo box to copy the current selection to the clipboard in CF_TEXT format.

WM_CUT
An application sends a WM_CUT message to an edit control or combo box to delete (cut) the current selection, if any, in the edit control and copy the deleted text to the clipboard in CF_TEXT format.

WM_PASTE
An application sends a WM_PASTE message to an edit control or combo box to copy the current content of the clipboard to the edit control at the current caret position. Data is inserted only if the clipboard contains data in CF_TEXT format.



Notifications
WM_ASKCBFORMATNAME
The WM_ASKCBFORMATNAME message is sent to the clipboard owner by a clipboard viewer window to request the name of a CF_OWNERDISPLAY clipboard format.

A window receives this message through its WindowProc function.


WM_CHANGECBCHAIN
The WM_CHANGECBCHAIN message is sent to the first window in the clipboard viewer chain when a window is being removed from the chain.

A window receives this message through its WindowProc function.


WM_DESTROYCLIPBOARD
The WM_DESTROYCLIPBOARD message is sent to the clipboard owner when a call to the EmptyClipboard function empties the clipboard.

A window receives this message through its WindowProc function.


WM_DRAWCLIPBOARD
The WM_DRAWCLIPBOARD message is sent to the first window in the clipboard viewer chain when the content of the clipboard changes. This enables a clipboard viewer window to display the new content of the clipboard.

A window receives this message through its WindowProc function.


WM_HSCROLLCLIPBOARD
The WM_HSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window. This occurs when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's horizontal scroll bar. The owner should scroll the clipboard image and update the scroll bar values.

WM_PAINTCLIPBOARD
The WM_PAINTCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area needs repainting.

WM_RENDERALLFORMATS
The WM_RENDERALLFORMATS message is sent to the clipboard owner before it is destroyed, if the clipboard owner has delayed rendering one or more clipboard formats. For the content of the clipboard to remain available to other applications, the clipboard owner must render data in all the formats it is capable of generating, and place the data on the clipboard by calling the SetClipboardData function.

A window receives this message through its WindowProc function.


WM_RENDERFORMAT
The WM_RENDERFORMAT message is sent to the clipboard owner if it has delayed rendering a specific clipboard format and if an application has requested data in that format. The clipboard owner must render data in the specified format and place it on the clipboard by calling the SetClipboardData function.

WM_SIZECLIPBOARD
The WM_SIZECLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and the clipboard viewer's client area has changed size.

WM_VSCROLLCLIPBOARD
The WM_VSCROLLCLIPBOARD message is sent to the clipboard owner by a clipboard viewer window when the clipboard contains data in the CF_OWNERDISPLAY format and an event occurs in the clipboard viewer's vertical scroll bar. The owner should scroll the clipboard image and update the scroll bar values.



Structures
METAFILEPICT
The METAFILEPICT structure defines the metafile picture format used for exchanging metafile data through the clipboard.



--------------------------------------------------------------------------------

© 2004 Microsoft Corporation. All rights reserved.
Julian J. Pracht
  Mit Zitat antworten Zitat
Benutzerbild von Assun
Assun

Registriert seit: 3. Feb 2005
Ort: Hilzingen am Bodensee
469 Beiträge
 
Delphi 2005 Personal
 
#6

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 14. Apr 2005, 16:14
danke, aber das sagt mir rein gar nichts
Sebastian Dietrich
http://Assun.de - bald komplett überarbeitet
  Mit Zitat antworten Zitat
marabu

Registriert seit: 6. Apr 2005
10.109 Beiträge
 
#7

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 14. Apr 2005, 16:32
In der Hilfe zum WIN32 SDK ist ein C Beispielprogramm zu einem ClipBoard-Viewer. Vielleicht gibt dir das ein paar Anregungen.
  Mit Zitat antworten Zitat
Benutzerbild von Assun
Assun

Registriert seit: 3. Feb 2005
Ort: Hilzingen am Bodensee
469 Beiträge
 
Delphi 2005 Personal
 
#8

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 14. Apr 2005, 18:00
hmmmm...gibst noch ne Andere Möglichkeit, den Druck auf "Druck" (was für ein Wortspiel ) abzufangen ?
Sebastian Dietrich
http://Assun.de - bald komplett überarbeitet
  Mit Zitat antworten Zitat
Benutzerbild von Assun
Assun

Registriert seit: 3. Feb 2005
Ort: Hilzingen am Bodensee
469 Beiträge
 
Delphi 2005 Personal
 
#9

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 15. Apr 2005, 16:39
weis keiner wat ?
Sebastian Dietrich
http://Assun.de - bald komplett überarbeitet
  Mit Zitat antworten Zitat
Benutzerbild von Lannes
Lannes

Registriert seit: 30. Jan 2005
Ort: Münster
745 Beiträge
 
Delphi 3 Professional
 
#10

Re: Bei druck auf "Druck" bild erstellen. Programm

  Alt 15. Apr 2005, 17:43
Hallo,

kleiner Tipp Hier im Forum suchenDrucktaste


von Luckie Tastatur überwachen

alternative Vorgehensweise:
...benachrichtigt werden, wenn die Zwischenablage geändert wird?
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:50 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz