Autor Beitrag
Jakob_Ullmann
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Do 23.08.07 08:13 
Hallo,

ich möchte eine Bitmap eines Image.Picture in die Zwischenablage kopieren. So, dass ich dann bei Word nach Druck auf CONTROL+V das Bild sehe. Ich mache das bisher so: (abgewandelte Version der HELPFILE, da das Beispiel nicht funktionierte)
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
procedure TForm1.SpeedButton5Click(Sender: TObject);
var
  MyFormat : Word;
  Bitmap : TBitMap;
  AData,APalette : THandle;
  MyPalette: HPALETTE;
begin
  Bitmap := TBitmap.Create;
  try
    Bitmap := Image1.Picture.Bitmap;
    Bitmap.SaveToClipBoardFormat(MyFormat,AData,MyPalette);
    ClipBoard.SetAsHandle(MyFormat,AData);
  finally
    Bitmap.Free;
  end;
end;

Funktioniert soweit, bei Word erscheint es. Dann rufe ich das Programm auf, zwei Fehlermeldungen, das Bild ist plötzlich leer und nach beenden des Programmes gibt es noch eine Fehlermeldung.
Weiß jemand, wie man das besser machen kann? Clipbrd ist eingebunden.
Beim Beispiel hat der letzte Typ APalette (THandle) nicht übereingestimmt. Deshalb habe ich noch MyPalette definiert.
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10183
Erhaltene Danke: 1256

W10ent
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Do 23.08.07 10:24 
Moin!

Probier das mal so:
ausblenden Delphi-Quelltext
1:
Clipboard.Assign(Image1.Picture.Bitmap);					

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Jakob_Ullmann Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1747
Erhaltene Danke: 15

Win 7, *Ubuntu GNU/Linux*
*Anjuta* (C, C++, Python), Geany (Vala), Lazarus (Pascal), Eclipse (Java)
BeitragVerfasst: Do 23.08.07 15:34 
Ja, hatte jetzt erst mal 5 Stunden (wenn das reicht) kein Internet zur Verfügung, aber funktioniert perfekt. Danke!