Clipboard Question

S

Sean Rohead

I am creating an Office addin in C++/ATL and create a custom toolbar. The
Office 2000 API requires that toolbar images be copied to the clipboard
before they can be set on a custom toolbar button. Obviously, destroying
the contents of the user's clipboard is a Bad Thing and I'm trying to find
the best way to save the contents before I erase the clipboard so I can
restore the original contents when I am finished.

I started out using OpenClipboard() and it seemed to work OK until I noticed
that copying text from a PowerPoint presentation puts data on the clipboard
in a couple of formats for which calling GetClipboardData() returns NULL.
The formats in question are 'PowerPoint 8.0 Internal Text' and 'PowerPoint
8.0 Internal Slides'. It occurred to me that perhaps these were formats
that could only be retrieved using the OLE Clipboard. So I switched to
OleGetClipboard() and noticed that not all of the formats were available
using the OLE Clipboard that were available using the standard clipboard.

PowerPoint copies the following formats to the clipboard that are not
enumerated using the OLE Clipboard:

'DataObject' (#49161)
'Ole Private Data' (#49171)
CF_LOCALE (#16)
CF_OEMTEXT (#7)

When I copy a cell in Excel, the following formats are enumerated through
the standard clipboard, but not the OLE clipboard:

'DataObject' (#49161)
'Native' (#49156)
'OwnerLink' (#49155)
'ObjectLink' (#49154)
'Ole Private Data' (#49171)
CF_LOCALE (#16)
CF_OEMTEXT (#7)
CF_DIB (#8)
CF_DIBV5 (#17)

It seems like no matter which clipboard I use I will be losing some data.
Which clipboard should I use? Is there some easier way to save and restore
the contents of the clipboard rather than copying all of the data it
contains?

Thank you,

Sean Rohead
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top