The OleConvertOLESTREAMToIStorage function converts the specified object from the OLE 1 storage model to an OLE 2 structured storage object without specifying presentation data.
WINOLEAPI OleConvertOLESTREAMToIStorage( _In_ LPOLESTREAM lpolestream, _Out_ IStorage *pstg, _In_ const DVTARGETDEVICE *ptd );
- lpolestream [in]
A pointer to a stream that contains the persistent representation of the object in the OLE 1 storage format.
- pstg [out]
A pointer to the IStorage interface on the OLE 2 structured storage object.
- ptd [in]
A pointer to the DVTARGETDEVICE structure that specifies the target device for which the OLE 1 object is rendered.
This function supports the standard return value E_INVALIDARG, in addition to the following:
The object was successfully converted.
The object either has no presentation data or uses native data for its presentation.
- DV_E_DVTARGETDEVICE or DV_E_DVTARGETDEVICE_SIZE
Invalid value for ptd.
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.
- Repeat Step 3 until the file is completely read.
Minimum supported client
|Windows 2000 Professional [desktop apps only]|
Minimum supported server
|Windows 2000 Server [desktop apps only]|