Page 1 of 1

Place multiple objects in the clipboard

Posted: Tue Dec 21, 2021 5:31 pm
by blueznl
PB has its own Clipboard functions, but they won't do what I need. Does anybody know how to stuff the clipboard with different formats, then trigger an update message, using WinApi?

(If there is some tool that does it, that'll do as well, but I couldn't find one thus far.)

Background:

What I'm trying to write: a little tool that monitors the clipboard, and shows the contents. If the user clicks a button it will replace the contents with a reformatted version.

Purpose: I often have to convert between different text formats, and no longer want to do so by hand :-)

Data: text (I might have to support unicode, dunno' yet, but I primarily want to support regular text, bold, and italics. It's fine to strip anything else, although centered is a nice-to-have. I certainly DON'T want styles.)

Principle:

1. Detect a clipboard update
2. Check for text and html versions of the data (I could dig into RTF but it seems all regular programs also set a HTML block, which is good enough for me right now... thus far)
3. Grab and simplify and show the data
4. User clicks any of the formatting options
5. Data is reformatted
6. Data is returned to the clipboard

I think I can do most of the above, I just need some good ways to show the data, and especially return the data to the clipboard.

Re: Place multiple objects in the clipboard

Posted: Wed Dec 22, 2021 1:02 am
by BarryG
Start with these links:

Replace rich text in the clipboard -> https://www.purebasic.fr/english/viewto ... 58#p480158

Know if there's rich text in clipboard -> https://www.purebasic.fr/english/viewtopic.php?t=62437

Clipboard listener -> https://www.purebasic.fr/english/viewtopic.php?t=69288

Re: Place multiple objects in the clipboard

Posted: Sat Dec 25, 2021 12:45 am
by blueznl
Ah, I found some examples, but these should help!

So, it seems like it's just about stuffing the clipboard with different data objects, but there's no 'start stuffing' or 'done stuffing', is there?

Re: Place multiple objects in the clipboard

Posted: Wed Jan 12, 2022 8:53 am
by BarryG
blueznl wrote: Sat Dec 25, 2021 12:45 amthere's no 'start stuffing' or 'done stuffing', is there?
Don't know, sorry.