# GetConvertStg

Returns the current value of the convert bit for the specified storage object.

WINOLEAPI GetConvertStg(

IStorage * pStg | //Points to the IStorage interface on the storage object
); |

Parameter

pStg
  [in] IStorage pointer to the storage object from which the convert bit is to be retrieved.

Return Values

S_OK
  Indicates the convert bit is set to TRUE.
S_FALSE
  Indicates the convert bit is cleared (FALSE).
STG_E_ACCESSDENIED
  Access denied because the caller has insufficient permission, or another caller has the file open and locked.
STG_E_LOCKVIOLATION
  Access denied because another caller has the file open and locked.

IStorage::OpenStream, IStorage::OpenStorage, and IStream::Read storage and stream access errors.

Comments

The GetConvertStg function is called by object servers that support the conversion of an object from one format to another. The server must be able to read the storage object using the format of its previous CLSID and write the object using the format of its new CLSID to support the object’s conversion. For example, a spreadsheet created by one application can be converted to the format used by a different application.

The convert bit is set by a call to the SetConvertStg function. A container application can call this function on the request of an end user, or a setup program can call it when installing a new version of an application. An end user requests converting an object through the Convert To dialog box. When an object is converted, the new CLSID is permanently assigned to the object, so the object is subsequently associated with the new CLSID.

Then, when the object is activated, its server calls the GetConvertStg function to retrieve the value of the convert bit from the storage object. If the bit is set, the object’s CLSID has been changed, and the server must read the old format and write the new format for the storage object.

After retrieving the bit value, the object application should clear the convert bit by calling the SetConvertStg function with its fConvert parameter set to FALSE.

See Also

SetConvertStg