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.
When you open the clipboard to put data into it, you must call EmptyClipboard to signal Windows ...