Udostępnij za pośrednictwem


COleDataSource::CacheData

Call this function to specify a format in which data is offered during data transfer operations.

void CacheData(
   CLIPFORMAT cfFormat,
   LPSTGMEDIUM lpStgMedium,
   LPFORMATETC lpFormatEtc = NULL 
);

Parameters

  • cfFormat
    The Clipboard format in which the data is to be offered. This parameter can be one of the predefined Clipboard formats or the value returned by the native Windows RegisterClipboardFormat function.

  • lpStgMedium
    Points to a STGMEDIUM structure containing the data in the format specified.

  • lpFormatEtc
    Points to a FORMATETC structure describing the format in which the data is to be offered. Provide a value for this parameter if you want to specify additional format information beyond the Clipboard format specified by cfFormat. If it is NULL, default values are used for the other fields in the FORMATETC structure.

Remarks

You must supply the data, because this function provides it by using immediate rendering. The data is cached until needed.

Supply the data using a STGMEDIUM structure. You can also use the CacheGlobalData member function if the amount of data you are supplying is small enough to be transferred efficiently using an HGLOBAL.

After the call to CacheData the ptd member of lpFormatEtc and the contents of lpStgMedium are owned by the data object, not by the caller.

To use delayed rendering, call the DelayRenderData or DelayRenderFileData member function. For more information on delayed rendering as handled by MFC, see the article Data Objects and Data Sources: Manipulation.

For more information, see the STGMEDIUM and FORMATETC structures in the Windows SDK*.*

For more information, see RegisterClipboardFormat in the Windows SDK.

Requirements

Header: afxole.h

See Also

Reference

COleDataSource Class

Hierarchy Chart

COleDataSource::CacheGlobalData

COleDataSource::DelayRenderData

COleDataSource::DelayRenderFileData

COleDataSource::SetClipboard

COleDataSource::DoDragDrop

Other Resources

COleDataSource Members