# OleDuplicateData

Duplicates the data found in the specified handle and returns a handle to the duplicated data. The source data is in a clipboard format. Use this function to help implement some of the data transfer interfaces such as IDataObject.

HANDLE OleDuplicateData(

HANDLE hSrc, | //Handle of the source data
CLIPFORMAT cfFormat, | //Clipboard format of the source data
UINT uiFlags | //Flags used in global memory allocation
); |

Parameters

hSrc
  [in] Handle of the source data.
cfFormat
  [in] Clipboard format of the source data.
uiFlags
  [in] Flags to be used to allocate global memory for the copied data. These flags are passed to GlobalAlloc. If the value of uiFlags is NULL, GMEM_MOVEABLE is used as a default flag.

Return Values

handle
  When the function is successful, contains the handle to the new data because data was successfully duplicated.
NULL
  A NULL return value indicates that there was an error duplicating data.

Remarks

The CF_METAFILEPICT, CF_PALETTE, or CF_BITMAP formats receive special handling. They are GDI handles and a new GDI object must be created instead of just copying the bytes. All other formats are duplicated byte-wise. For the formats that are duplicated byte-wise, hSrc must be a global memory handle.