OleConvertOLESTREAMToIStorage function (ole2.h)
The OleConvertOLESTREAMToIStorage function converts the specified object from the OLE 1 storage model to an OLE 2 structured storage object without specifying presentation data.
Syntax
HRESULT OleConvertOLESTREAMToIStorage(
[in] LPOLESTREAM lpolestream,
[out] LPSTORAGE pstg,
[in] const DVTARGETDEVICE *ptd
);
Parameters
[in] lpolestream
A pointer to a stream that contains the persistent representation of the object in the OLE 1 storage format.
[out] pstg
A pointer to the IStorage interface on the OLE 2 structured storage object.
[in] ptd
A pointer to the DVTARGETDEVICE structure that specifies the target device for which the OLE 1 object is rendered.
Return value
This function supports the standard return value E_INVALIDARG, in addition to the following:
Remarks
This function converts an OLE 1 object to an OLE 2 structured storage object. Use this function to update OLE 1 objects to OLE 2 objects when a new version of the object application supports OLE 2.
On entry, the lpolestm parameter should be created and positioned just as it would be for an OleLoadFromStream function call. On exit, the lpolestm parameter is positioned just as it would be on exit from an OleLoadFromStream function, and the pstg parameter contains the uncommitted persistent representation of the OLE 2 storage object.
For OLE 1 objects that use native data for their presentation, the OleConvertOLESTREAMToIStorage function returns CONVERT10_S_NO_PRESENTATION. On receiving this return value, callers should call IOleObject::Update to get the presentation data so it can be written to storage.
Applications that do not use the OLE default caching resources, but use the conversion resources, can use an alternate function, OleConvertOLESTREAMToIStorageEx, which can specify the presentation data to convert. In the OleConvertOLESTREAMToIStorageEx function, the presentation data read from the OLESTREAM structure is passed out and the newly created OLE 2 storage object does not contain a presentation stream.
The following procedure describes the conversion process using OleConvertOLESTREAMToIStorage.
Converting an OLE 1 object to an OLE 2 storage object
- Create a root IStorage object by calling the StgCreateDocfile function (..., &pstg).
- Open the OLE 1 file (using OpenFile or another OLE 1 technique).
- Read from the file, using the OLE 1 procedure for reading files, until an OLE object is found.
- Allocate an
IStorage object from the root
IStorage created in Step 1.
pstg->lpVtbl->CreateStorage(...&pStgChild); hRes = OleConvertIStorageToOLESTREAM(polestm, pStgChild); hRes = OleLoad(pStgChild, &IID_IOleObject, pClientSite, ppvObj);
- Repeat Step 3 until the file is completely read.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | ole2.h |
Library | Ole32.lib |
DLL | Ole32.dll |
See also
OleConvertIStorageToOLESTREAMEx