# OleGetAutoConvert

Determines whether the registry is set for objects of a specified CLSID to be automatically converted to another CLSID, and if so, retrieves the new CLSID.

WINOLEAPI OleGetAutoConvert(

REFCLSID clsidOld, | //CLSID of the object to be converted
LPCLSID pClsidNew | //Pointer to new CLSID for object being converted
); |

Parameters

clsidOld
  [in] CLSID for an object to determine whether that CLSID is set for automatic conversion.
pClsidNew
  [out] Pointrt to where the new CLSID, if any, is written. If auto-conversion for clsidOld is not set in the registry, clsidOld is written to that location. The pClsidNew parameter is never NULL.

Return Values

This function supports the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following:

S_OK
  IA value was successfully returned through the pclsidNew parameter.
REGDB_E_CLASSNOTREG
  The clsidOld CLSID is not properly registered in the registry.
REGDB_E_READREGDB
  Error reading the registry.
REGDB_E_KEYMISSING
  Auto-convert is not active or there was no registry entry for the clsidOld parameter.

Remarks

The OleGetAutoConvert function returns the AutoConvertTo entry in the registry for the specified object. The AutoConvertTo subkey specifies whether objects of a given CLSID are to be automatically converted to a new CLSID. This is usually used to convert files created by older versions of an application to the current version. If there is no AutoConvertTo entry, this function returns the value of clsidOld.

The OleDoAutoConvert function calls OleGetAutoConvert to determine if the object specified is to be converted. A container application that supports object conversion should call OleDoAutoConvert each time it loads an object. If the container uses the OleLoad helper function, it need not call OleDoAutoConvert explicitly because OleLoad calls it internally.

To set up automatic conversion of a given class, you can call the OleSetAutoConvert function (typically in the setup program of an application installation). This function uses the AutoConvertTo subkey to tag a class of objects for automatic conversion to a different class of objects. This is a subkey of the CLSID key, and contains the following information:

    CLSID\{clsid}=MainUserTypeName\AutoConvertTo = clsid

See Also

OleSetAutoConvert, OleDoAutoConvert