OleGetAutoConvert function (ole2.h)

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.

Syntax

HRESULT OleGetAutoConvert(
  [in]  REFCLSID clsidOld,
  [out] LPCLSID  pClsidNew
);

Parameters

[in] clsidOld

The CLSID for the object.

[out] pClsidNew

A pointer to a variable to receive the new CLSID, if any. If auto-conversion for clsidOld is not set in the registry, clsidOld is returned. The pClsidNew parameter is never NULL.

Return value

This function can return the standard return values E_INVALIDARG, E_OUTOFMEMORY, and E_UNEXPECTED, as well as the following values.

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

Remarks

OleGetAutoConvert 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 whether 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.

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
API set ext-ms-win-com-ole32-l1-1-0 (introduced in Windows 8)

See also

AutoConvertTo

OleDoAutoConvert

OleSetAutoConvert