OleConvertOLESTREAMToIStorage function

The OleConvertOLESTREAMToIStorage function converts the specified object from the OLE 1 storage model to an OLE 2 structured storage object without specifying presentation data.

Note  This is one of several compatibility functions.

Syntax


WINOLEAPI OleConvertOLESTREAMToIStorage(
  _In_   LPOLESTREAM lpolestream,
  _Out_  IStorage *pstg,
  _In_   const DVTARGETDEVICE *ptd
);

Parameters

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.

Return value

This function supports the standard return value E_INVALIDARG, in addition to the following:

S_OK

The object was successfully converted.

CONVERT10_S_NO_PRESENTATION

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.

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.

Aa380055.wedge(en-us,VS.85).gifConverting an OLE 1 object to an OLE 2 storage object

  1. Create a root IStorage object by calling the StgCreateDocfile function (..., &pstg).
  2. Open the OLE 1 file (using OpenFile or another OLE 1 technique).
  3. Read from the file, using the OLE 1 procedure for reading files, until an OLE object is found.
  4. 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);
    
    
  5. Repeat Step 3 until the file is completely read.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Ole2.h

Library

Ole32.lib

DLL

Ole32.dll

See also

CoIsOle1Class
OleConvertIStorageToOLESTREAM
OleConvertIStorageToOLESTREAMEx
OleConvertOLESTREAMToIStorageEx
DVTARGETDEVICE
STGMEDIUM
TYMED

 

 

Community Additions

ADD
Show:
© 2014 Microsoft