Beyond Simple Clipboard Use
We’ve seen that transferring text from the clipboard requires four calls after the data has been prepared:
OpenClipboard (hwnd) ; EmptyClipboard () ; SetClipboardData (iFormat, hGlobal) ; CloseClipboard () ;
Getting access to this data requires three calls:
OpenClipboard (hwnd) ;
hGlobal = GetClipboardData (iFormat) ;
[other program lines]
CloseClipboard () ;
You can make a copy of the clipboard data or use it in some other manner between the GetClipboardData and CloseClipboard calls. That approach may be all you’ll need for most purposes, but you can also use the clipboard in more sophisticated ways.
Using Multiple Data Items
When you open the clipboard to put data into it, you must call EmptyClipboard to signal Windows ...
Get Programming Windows®, Fifth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.