TBitmap.LoadFromClipboardFormat method lazarus / 39-Graphics ---------------------------------------------------------------------- skywriter · 2007-07-27 12:07 The story so far. Application contains Form1:TForm, Image1:TImage, Button1:TButton both in Lazarus and in Delphi project. In Lazarus project: procedure TForm1.BitBtn1Click(Sender: TObject); var   BMP : TBitmap; begin   BMP := TBitmap.Create;   BMP.LoadFromClipboardFormat( CF_BITMAP );   Image1.Picture.Bitmap.Assign( BMP ); end; In Delphi project: procedure TForm1.Button1Click(Sender: TObject); var   BMP : TBitmap; begin   BMP := TBitmap.Create;   BMP.LoadFromClipboardFormat(CF_Bitmap, ClipBoard.GetAsHandle(CF_Bitmap), 0);   Image1.Picture.Bitmap.Assign( BMP ); end; Then i copy part of image from MS Paint into clipboard. After that, when i press "Button1" in Delphi project i see the same copied part of image on the form.  When i press "Button1" in Lazarus project there nothing happens. What i do wrong? ---------------------------------------------------------------------- arnoldb · 2007-07-27 13:16 Slightly confusing...  You are trapping a BitBtn1Click in Lazarus, yet you say you have a Button1:TButton Do you have a Button1Click event assigned in Lazarus to Button1's onclick, or is BitBtn1Click assigned to button1's onclick in Lazarus? ---------------------------------------------------------------------- wile64 · 2007-07-27 15:50 I use this Bitmap.LoadFromClipboardFormat(PredefinedClipboardFormat(pcfPixmap)); who run well… ---------------------------------------------------------------------- skywriter · 2007-07-30 09:07 arnoldb: I think type of button control doesn't matter in this case. Quote from: "wile64"I use this Bitmap.LoadFromClipboardFormat(PredefinedClipboardFormat(pcfPixmap)); who run well… Tried. Result is the same as with BMP.LoadFromClipboardFormat( CF_BITMAP ). I went ste-by-step to method Code: [Select]function TClipboard.AssignToGraphic(Dest: TGraphic; FormatID: TClipboardFormat   ): boolean; var   MemStream: TMemoryStream; begin   Result:=false;   if FormatID=0 then exit;   MemStream:=TMemoryStream.Create;   try     if not GetFormat(FormatID,MemStream) then exit;     MemStream.Position:=0;     Dest.LoadFromMimeStream(MemStream,ClipboardFormatToMimeType(Format ID));   finally     MemStream.Free;   end;   Result:=true; end; and i saw GetFormat(FormatID,MemStream) returns false. Where is bug? I need this feature to get snapshot from clipboard as in method  TVideo.CapGrabFrame(Destination: TBitmap) of "SysRec" project...Please help! :cry: ---------------------------------------------------------------------- skywriter · 2007-08-03 05:53 wile64: Can you tell which version of Lazarus you use and example of code properly works? I believe the bug must be fixed. No matter is this my bug or Lazarus- developers bug. ---------------------------------------------------------------------- skywriter · 2007-08-09 08:37 while64: What about this (file \lazarus\lcl\include\intfbaselcl.inc): Code: [Select] // the clipboard functions are internally used by TClipboard function TWidgetSet.ClipboardFormatToMimeType(FormatID: TClipboardFormat): string; begin   Result := ''; end; How it can work at all?! ---------------------------------------------------------------------- skywriter · 2007-08-10 08:48 Temporarily found usable workaround: function capFileSaveDIB of VfW then TBitmap.LoadFromFile. ---------------------------------------------------------------------- Marc · 2007-08-14 09:03 TWidgetSet.xxx only contains empty "abstract" methods and functions. The real implementation is done in the derived widgetset like TWSWin32Widgetset or TWSgtkWidgetset