(Click here to view complete article on Code Project)
The Clipboard class uses global memory to store and retrieve data during cut, copy and paste operations
and when dragging and dropping files. It accomplishes this by storing data pertaining to the object in
fragments with various formats to represent different aspects of the data being acted upon.
Windows provides a hook for anyone interested in intercepting data from the Clipboard by allowing
us to add ourself to a chain or linked list of listeners. The only thing we need to do here is to relay
the data passed to us to the next listener in the chain. Don't break the chain or you'll be dancing on
thin ice! i.e. unpredictable things can happen.
The
ClipSpy+ application is fully functional and will persist data as long
as it is active. I had intended on upgrading it to store the data in a
database or Xml file for long term persistence if there were interest
and given that I had the time to do the upgrade.