Question

i am looking from win32 APIs which would allow me to make a backup of the clipboard data (in memory/ file system) and later i can reset it using SetClipboardData.

i have seen the win32 API set and understand that OpenClipboard, getClipboardData and SetClipboardData would do the task for me. But i don't understand what format parameter to pass in GetClipboardData function, as i am unaware about the format and don't know any API either to get Format of the Clipboard data.

i want to support maximum possible formats, i know things like delay rendering and some private data types might not be possible to save. What could be the best way out, please suggest...


I am able to backup and restore the text content. how to do the same for Bitmap format. How to basically save the BITMAP in memory from its handle (fetched using GetClipboardData)

Was it helpful?

Solution

Find the formats on the clipboard by calling EnumClipboardFormats(). Call GetClipboardData() to get a HGLOBAL that contains the clipboard data for a particular format. You can get the size of the memory by calling GlobalSize(). To read the memory wrapped by the HGLOBAL use GlobalLock() and GlobalFree().

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top