OleConvertIStorageToOLESTREAMEx

Converts the specified storage object from OLE 2 structured storage to the OLE 1 storage model, including the presentation data. This is one of several compatibility functions.

WINOLEAPI OleConvertIStorageToOLESTREAMEx(
  IStorage * pStg,      //Pointer to the OLE 2 storage object to be 
                        // converted
  CLIPFORMAT cfFormat,  //Presentation data format
  LONG lWidth,          //Width in HIMETRIC
  LONG lHeight,         //Height in HIMETRIC
  DWORD dwSize,         //Size of data
  STGMEDIUM pmedium,    //Pointer to data
  LPOLESTREAM lpolestm  //Pointer to the stream where the OLE1 
                        // storage is written
);
 

Parameters

pStg
[in] Pointer to the IStorage interface on the storage object to be converted to an OLE 1 storage.
cfFormat
[in] Format of the presentation data. May be NULL, in which case the lWidth, lHeight, dwSize, and pmedium parameters are ignored.
lWidth
[in] Width of the object presentation data in HIMETRIC units.
lHeight
[in] Height of the object presentation data in HIMETRIC units.
dwSize
[in] Size of the data, in bytes, to be converted.
pmedium
[in] Pointer to the STGMEDIUM structure for the serialized data to be converted. See STGMEDIUM for more information.
lpolestm
[out] Pointer to a stream where the persistent representation of the object is saved using the OLE 1 storage model.

Return Values

This function supports the standard return value E_INVALIDARG, as well as the following:

S_OK
The conversion was completed successfully.
DV_E_STGMEDIUM
The hGlobal member of STGMEDIUM is NULL.
DV_E_TYMED
The tymed member of the STGMEDIUM structure is not TYMED_HGLOBAL or TYMED_ISTREAM.

Remarks

The OleConvertIStorageToOLESTREAMEx function converts an OLE 2 storage object to OLE 1 format. It differs from the OleConvertIStorageToOLESTREAM function in that the presentation data to be written to the OLE 1 storage is passed in.

Because OleConvertIStorageToOLESTREAMEx can specify which presentation data to convert, it can be used by applications that do not use OLE default caching resources but do use OLE's conversion resources.

The value of the tymed member of STGMEDIUM must be either TYMED_HGLOBAL or TYMED_ISTREAM; refer to the TYMED enumeration for more information. The medium is not released by OleConvertIStorageToOLESTREAMEx.

QuickInfo

  Windows NT: Use version 3.1 or later.
  Windows: Use Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in ole2.h.
  Import Library: Included as a resource in ole32.dll.

See Also

CoIsOle1Class, OleConvertIStorageToOLESTREAM, OleConvertOLESTREAMToIStorage, OleConvertOLESTREAMToIStorageEx, STGMEDIUM structure, TYMED enumeration