Place multiple objects in the clipboard

Windows specific forum
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Place multiple objects in the clipboard

Post 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.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
BarryG
Addict
Addict
Posts: 3293
Joined: Thu Apr 18, 2019 8:17 am

Re: Place multiple objects in the clipboard

Post 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
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6161
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Place multiple objects in the clipboard

Post 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?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
BarryG
Addict
Addict
Posts: 3293
Joined: Thu Apr 18, 2019 8:17 am

Re: Place multiple objects in the clipboard

Post by BarryG »

blueznl wrote: Sat Dec 25, 2021 12:45 amthere's no 'start stuffing' or 'done stuffing', is there?
Don't know, sorry.
Post Reply