SetClipboardData() and CF_PRIVATEFIRSTLast reviewed: November 2, 1995Article ID: Q24252 |
The information in this article applies to:
SUMMARY The documentation for SetClipboardData() states that CF_PRIVATEFIRST can be used to put private data formats on the clipboard. It also states that data of this format is not automatically deleted. However, that is apparently not true. That is, the data is removed automatically when the clipboard is emptied (sending a WM_DESTROYCLIPBOARD message) and the new item is set into the clipboard. The old item is shown; however, the handle now is invalid because GlobalFree() is called on it.
MORE INFORMATIONGlobalFree() was not called on this handle. If you try to use the other handle to this memory, you will find that the one you initially received from GlobalAlloc() is still valid. Only the clipboard handle has been invalidated by the call to EmptyClipboard(). The documentation states that "Data handles associated (with CF_PRIVATEFIRST) will not be freed automatically." This statement refers to the memory associated with that data handle. When SetClipboardData() is called under standard data types, it frees the block of memory identified by hMem. This is not the case for CF_PRIVATEFIRST. Applications that post CF_PRIVATEFIRST items on the clipboard are responsible for the memory block containing those items. This is not intended to imply that items placed on the clipboard will remain on the clipboard if they are CF_PRIVATEFIRST. When a call is made to EmptyClipboard(), all objects will be removed.
|
Additional reference words: 3.00 3.10 3.50 3.51 4.00 95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |