ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Strange error with TIEBitmap.CopyToClipboard

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
PeterPanino Posted - Aug 12 2017 : 16:51:03
I have a TImageEnMView with several images inserted with SetImageFromStream:



I need to select one of the images and copy it to the clipboard. So I wrote this code:

procedure TFormMain.mvDocImagesKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
var
  bm: TIEBitmap;
begin
  case Key of
    VK_C:
      begin
        if Shift*[ssShift, ssAlt, ssCtrl] = [ssCtrl] then
        begin
          bm := mvDocImages.GetTIEBitmap(mvDocImages.SelectedImage);
          try
            if not bm.CopyToClipboard() then // error here!!!
              Application.MessageBox('Copy to Clipboard failed.',
                PChar(Application.Title), MB_OK + MB_ICONSTOP + MB_TOPMOST);
          finally
            bm.Free;
          end;
        end;
      end;
  end;
end;


Unfortunately, the CopyToClipboard action RANDOMLY causes an error:



What does this error mean?

Is this a bug?
2   L A T E S T    R E P L I E S    (Newest First)
xequte Posted - Aug 13 2017 : 05:57:54
Hi

No, don't free it, call ReleaseBitmap. Please see the documentation at:

https://www.imageen.com/help/TImageEnMView.GetTIEBitmap.html



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
PeterPanino Posted - Aug 12 2017 : 17:24:55
When I delete this line:

bm.Free;

...then the error does not occur anymore.

But shouldn't the created TIEBitmap object be released?