copy and paste an image to clipboard lazarus / 39-Graphics ---------------------------------------------------------------------- dcelso · 2016-11-06 22:26 I tried do that here sais http://wiki.lazarus.freepascal.org/Clipboard Code: [Select]uses   Clipbrd, LCLIntf, LCLType, ...; procedure LoadBitmapFromClipboard(Bitmap: TBitmap); begin   if Clipboard.HasFormat(PredefinedClipboardFormat(pcfDelphiBitmap)) then     Bitmap.LoadFromClipboardFormat(PredefinedClipboardFormat(pcfDelphi Bitmap));   if Clipboard.HasFormat(PredefinedClipboardFormat(pcfBitmap)) then     Bitmap.LoadFromClipboardFormat(PredefinedClipboardFormat(pcfBitmap)); end; Save to clipboard uses   Clipbrd, ...; procedure SaveBitmapToClipboard(Bitmap: TBitmap); begin   Clipboard.Assign(Bitmap); end; In my example I only have a Timage and two buttons , copy and paste. when  I press the button always seem ok, but the paint does not recognice any pasted in the clipboarda. If I press "paste button" lazarus crasses only show a windows saying "error." ---------------------------------------------------------------------- wp · 2016-11-06 23:05 Without compilable sources I cannot say what's wrong. See the attachment for a working example. ---------------------------------------------------------------------- pixelink · 2019-04-19 14:31 Quote from: wp on November 07, 2016, 12:05:51 amWithout compilable sources I cannot say what's wrong. See the attachment for a working example. FYI... I downloaded and tested the example, but it only works within the Application. It doesn't actually copy/paste to/from the Windows clipboard At least not on my machine. Win 7 ---------------------------------------------------------------------- pixelink · 2019-04-19 14:37 FYI... here is an example that works for the real clipboard. http://lazplanet.blogspot.com/2013/05/image-copy-paste-clipboard.html ---------------------------------------------------------------------- wp · 2019-04-19 15:10 Quote from: pixelink on April 19, 2019, 04:31:05 pmFYI... I downloaded and tested the example, but it only works within the Application. It doesn't actually copy/paste to/from the Windows clipboard I don't know what you are doing. But this works: - Run the demo - Click "Copy" - Open "Paint" (or another image processing program), and "Edit" > "Paste" the image --> you'll see the Lazarus cheetah in "Paint". - Within "Paint" modify the image: paint something over it, erase something, and/or select a part of the image. "Edit" > "Copy" - back to the demo: Press "Paste" --> you'll see the modified image. ---------------------------------------------------------------------- pixelink · 2019-04-19 16:45 Quote from: wp on April 19, 2019, 05:10:04 pmQuote from: pixelink on April 19, 2019, 04:31:05 pmFYI... I downloaded and tested the example, but it only works within the Application. It doesn't actually copy/paste to/from the Windows clipboard I don't know what you are doing. But this works: - Run the demo - Click "Copy" - Open "Paint" (or another image processing program), and "Edit" > "Paste" the image --> you'll see the Lazarus cheetah in "Paint". - Within "Paint" modify the image: paint something over it, erase something, and/or select a part of the image. "Edit" > "Copy" - back to the demo: Press "Paste" --> you'll see the modified image. It'isn't hard... I downloaded the sample, opened it, ran it. I Changed nothing. it ONLY works within the app, image to image It doesn't copy the image to the clipboard so it can be pasted somewhere else... only within the app It doesn't paste into Paint or Ifranview I have Win 7 ---------------------------------------------------------------------- pixelink · 2019-04-19 16:49 I actually read some place on this forum beginning of this week, that a person was having the same issue. Copy/paste in the app only, but not in the Windows clipboard. They were even talking about it maybe being a bug of some sort ---------------------------------------------------------------------- pixelink · 2019-04-19 16:53 FYI.... if I copy another image outside of the program and click the paste button, it pastes fine But, doesn't copy (that leopard) to the Windows clipboard when clicking the "Copy" button from within the app. ---------------------------------------------------------------------- wp · 2019-04-19 17:01 Quote from: pixelink on April 19, 2019, 06:53:39 pmBut, doesn't copy (that leopard) to the Windows clipboard when clicking the "Copy" button from within the app. How do you know that it does not copy to the clipboard? The clipboard itself it not visible. Which program are you using to verify? Follow my recipe above and try to paste the image into Microsoft Paint. It must work. I tested Win 10 and Win 7 both with Laz trunk, and the former one also with Laz 2.0.2, Laz 2.0.0 and Laz 1.8.4 ---------------------------------------------------------------------- pixelink · 2019-04-19 17:06 Quote from: wp on April 19, 2019, 07:01:11 pmQuote from: pixelink on April 19, 2019, 06:53:39 pmBut, doesn't copy (that leopard) to the Windows clipboard when clicking the "Copy" button from within the app. How do you know that it does not copy to the clipboard? The clipboard itself it not visible. Which program are you using to verify? Follow my recipe above and try to paste the image into Microsoft Paint. It must work. I tested Win 10 and Win 7 both with Laz trunk, and the former one also with Laz 2.0.2, Laz 2.0.0 and Laz 1.8.4 Cause I Tried to paste into other apps. Didn't you read what I said above? ---------------------------------------------------------------------- pixelink · 2019-04-19 17:15 See screenshot 1) I clicked the "Copy" button 2) Immediately Opened Paint 3) Notice that the "Paste" is disabled... Therefore CAN NOT PASTE Do you think I am making this up to just cause trouble? It doesn't work on my Machine. Period! ---------------------------------------------------------------------- wp · 2019-04-19 17:39 Quote from: pixelink on April 19, 2019, 07:15:13 pmDo you think I am making this up to just cause trouble? It doesn't work on my Machine. Period! And do you think I am answering your questions in my free time to be shouted at? ---------------------------------------------------------------------- pixelink · 2019-04-19 17:57 Quote from: wp on April 19, 2019, 07:39:32 pmQuote from: pixelink on April 19, 2019, 07:15:13 pmDo you think I am making this up to just cause trouble? It doesn't work on my Machine. Period! And do you think I am answering your questions in my free time to be shouted at? 1) I didn't shout. 2) I didn't make this code. I explained myself in a couple of my post, above, but yet I get asked the same questions. What about my time. All I did is point out that the code example provided did not work. Yet, I am defending someone elses code that don't work. Does that make sense or is it wasting my time??? C'mon man ---------------------------------------------------------------------- Thausand · 2019-04-19 17:57 Quote from: pixelink on April 19, 2019, 07:15:13 pm1) I clicked the "Copy" button 2) Immediately Opened Paint 3) Notice that the "Paste" is disabled... Therefore CAN NOT PASTE Shout no good  Many time problem some were not find. I try suggest. Maybe not help but no shout. Make happy  1) open paint 2) click "Copy" button program lazarus 3) test paint paste Is now can paste ? If is paste, then error is not share clipboard when program close. Then only work two program open and run. Other problem maybe is clipboard format not support when paint. Not any program have support any clipboard format. ---------------------------------------------------------------------- pixelink · 2019-04-19 18:01 Quote from: Thausand on April 19, 2019, 07:57:36 pmQuote from: pixelink on April 19, 2019, 07:15:13 pm1) I clicked the "Copy" button 2) Immediately Opened Paint 3) Notice that the "Paste" is disabled... Therefore CAN NOT PASTE Shout no good  Many time problem some were not find. I try suggest. Maybe not help but no shout. Make happy  1) open paint 2) click "Copy" button program lazarus 3) test paint paste Is now can paste ? If is paste, then error is not share clipboard when program close. Then only work two program open and run. Other problem maybe is clipboard format not support when paint. Not any program have support any clipboard format. Dude... "CAN NOT PASTE" is not shouting but just pointing out what people are not getting. This is shouting... I AM ALL DONE ARGUING WITH YOU FOLKS OVER SOMEONE ELSES BROKEN CODE. GOOD DAY!!! ---------------------------------------------------------------------- Handoko · 2019-04-19 18:08 Sorry to interrupt. I think it was misunderstanding due to cultural differences. Some may consider typing text in all upper case is shouting. Peace. ---------------------------------------------------------------------- Thausand · 2019-04-19 18:09 Quote from: pixelink on April 19, 2019, 08:01:24 pmQuote from: Thausand on April 19, 2019, 07:57:36 pmQuote from: pixelink on April 19, 2019, 07:15:13 pm1) I clicked the "Copy" button 2) Immediately Opened Paint 3) Notice that the "Paste" is disabled... Therefore CAN NOT PASTE Shout no good  Many time problem some were not find. I try suggest. Maybe not help but no shout. Make happy  1) open paint 2) click "Copy" button program lazarus 3) test paint paste Is now can paste ? If is paste, then error is not share clipboard when program close. Then only work two program open and run. Other problem maybe is clipboard format not support when paint. Not any program have support any clipboard format. Dude... "CAN NOT PASTE" is not shouting but just pointing out what people are not getting. This is shouting... I AM ALL DONE ARGUING WITH YOU FOLKS OVER SOMEONE ELSES BROKEN CODE. GOOD DAY!!! I write reason why maybe not can paste. Is maybe you reason and you not want know ? You have problem shout more ? That no help ---------------------------------------------------------------------- lucamar · 2019-04-19 21:06 Quote from: pixelink on April 19, 2019, 07:15:13 pmSee screenshot 1) I clicked the "Copy" button 2) Immediately Opened Paint 3) Notice that the "Paste" is disabled... Therefore CAN NOT PASTE Do you think I am making this up to just cause trouble? It doesn't work on my Machine. Period! There is something strange going on, because here it works on: Windows XP, Windows 7 and even on Linux, as can be seen in the images. Are you using some kind of non-standard "clipboard manager"? And calm down, everyone here is interested in knowing why it doesn't work in your machine while it does in ours. ---------------------------------------------------------------------- Zath · 2019-04-19 22:34 Lazaus 1.84 / Win 10. Compiled and ran wp's little prog. A simple way to test paste is press the keyboard PrtSc/SysRq key for a screen shot. Then click the paste button on the prog and it pastes the screenshot in nicely. For copy, open MSPaint, open wp's app, then use paste in MSPaint. Nothing pastes (clipboard is empty). Click copy on the app to assign the leopard pic to the clipboard and then paste in MSPaint will work by pasting the leopard. Worked for me anyway. (For the record, text in caps has always been regarded as shouting since the early days of online chat, going way back into CompuServe days before the main www existed.) ---------------------------------------------------------------------- lucamar · 2019-04-19 22:39 Quote from: Zath on April 20, 2019, 12:34:33 am(For the record, text in caps has always been regarded as shouting since the early days of online chat, going way back into CompuServe days before the main www existed.) Not always. A short burst of al caps in a phrase was also intrepreted as emphasis, which, rather obviously, is what the OP intended with this:Quote from: pixelink on April 19, 2019, 07:15:13 pm3) Notice that the "Paste" is disabled... Therefore CAN NOT PASTE ---------------------------------------------------------------------- 440bx · 2019-04-19 22:51 Quote from: lucamar on April 20, 2019, 12:39:48 amNot always. A short burst of al caps in a phrase was also intrepreted as emphasis, which, rather obviously, is what the OP intended with this:Quote from: pixelink on April 19, 2019, 07:15:13 pm3) Notice that the "Paste" is disabled... Therefore CAN NOT PASTEThat sounds quite reasonable but.... when the caps are followed by... QuoteIt doesn't work on my Machine. Period!About the only reasonable conclusion one can draw is that you're being very kind.   Nice exclamation point.