External text handling

I'm planning on creating a program which allows you to have more than just one clipboard. I don't plan on manipulating or using the windows clipboard in any way, but make my own solution. I have an idea for the whole thing, but I'm stuck on one thing;

How will I allow my program to pick up on text that happens outside of itself?
Say I was on google.com, I type something into the search bar and highlight it with my cursor, how will my program be able to pick up on that?

I'm not even entirely sure if this is possible, but I imagine it is, does anyone have any ideas as to how I would achieve this?
Hey,
It is surely possible, let's say it might need a lot of work and expertise.
Specially for browser who are not the easiest beast to tame and come in a lot of variety.

For more "regular" windows, you may use RegisterHotKey to trigger a series of
GetForegroundWindow, GetWindowThreadProcessId, GetCurrentThreadId, AttachThreadInput, GetFocus, SendMessage/WM_GETTEXT... and have good result.

This said, life could be a lot easier using Windows clipboard APIs like OpenClipboard, GetClipboardData, and SetClipboardData.
RegisterClipboardFormat may also be used for a private clipboard.

If I may ask, any reason why you do not want to use those ClipBoard APIs?
I mean, they where designed just for that, to make data transfer easy between differents applications.
Last edited on
Sorry for the late reply, thought this post was dead.

I may resort to using one of those API's as any other solution seems a little too much for an intermediate C++ programmer like myself.

Thanks for the resources, though! Will look into those APIs :)
Topic archived. No new replies allowed.