OleCreateStaticFromData  5ZJ4_OP

Creates a static object (containing only a representation, with no native data) from a data transfer object.

WINOLEAPI OleCreateStaticFromData(

    LPDATAOBJECT pSrcDataObj,

//Pointer to the data transfer object

    REFIID riid,

//Reference to the identifier of the interface to be used to communicate with the new object

    DWORD renderopt,

//Value from OLERENDER

    LPFORMATETC pFormatEtc,

//Depending on renderopt, pointer to value from FORMATETC

    LPOLECLIENTSITE pClientSite,

//Pointer to the interface

    LPSTORAGE pStg,

//Pointer to store object

    LPVOID FAR* ppvObj

//Indirect pointer to the interface requested in riid

   );

 

 

Parameters

pSrcDataObj

[in] Pointer to the IDataObject interface on the data transfer object that holds the data from which the object will be created.

riid

[in] Reference to the identifier of the interface with which the caller is to communicate with the new object (usually IID_IOleObject, defined in the OLE headers as the interface identifier for IOleObject).

renderopt

[in] Value from the enumeration OLERENDER1W1IE2P indicating the locally cached drawing or data-retrieval capabilities that the container wants in the newly created component. It is an error to pass the render options OLERENDER_NONE or OLERENDER_ASIS to this function.

pFormatEtc

[in] Depending on which of the OLERENDER flags is used as the value of renderopt, may be a pointer to one of the FORMATETC8CSQ18 enumeration values. Refer to the OLERENDER enumeration for restrictions.

pClientSite

[in] Pointer to an instance of IOleClientSite, the primary interface through which the object will request services from its container. May be NULL.

pStg

[in] Pointer to the IStorageFS1VT1 interface for storage for the object. This parameter may not be NULL.

ppvObj

[out] When the function returns successfully, indirect pointer to the interface requested in riid on the newly created object.

 

Return Value

S_OK

The object was successfully created.

 

Remarks

The OleCreateStaticFromData function can convert any object, as long as it provides an IDataObjectZHWNNR interface, to a static object. It is useful in implementing the Convert To Picture option for OLE linking or embedding.

Static objects can be created only if the source supports one of the OLE-rendered clipboard formats: CF_METAFILEPICT, CF_DIB, or CF_ BITMAP, and CF_ENHMF.

You can also call OleCreateStaticFromData to paste a static object from the clipboard. To determine whether an object is static, call the OleQueryCreateFromData1NGA23Q function, which returns OLE_S_STATIC if one of CF_METAFILEPICT, CF_DIB, or CF_BITMAP is present and an OLE format is not present. This indicates that you should call OleCreateStaticFromData rather than the OleCreateFromData2DRR4H5 function to create the object.

The new static object is of class CLSID_StaticMetafile (in the case of CF_METAFILEPICT) and CLSID_StaticDib (in the case of CF_DIB or CF_BITMAP). The static object sets the OLEMISC_STATIC and OLE_CANTLINKINSIDE bits returned from IOleObject::GetMiscStatus. The static object will have the aspect DVASPECT_CONTENT and a LINDEX of -1.

The pDataObject is still valid after OleCreateStaticFromData returns. It is the caller s responsibility to free pDataObject   OLE does not release it.

There cannot be more than one presentation stream in a static object.

 

Note  The OLESTREAM<->IStorageFS1VT1 conversion functions also convert static objects.

 

See Also

OleCreateFromData