3.7.4.11 ITypeInfo::CreateInstance (Opnum 16)
The CreateInstance method creates a new instance of a type that describes a COM server (coclass).
-
HRESULT CreateInstance( [in] REFIID riid, [out, iid_is(riid)] IUnknown** ppvObj );
riid: MUST be an IID.
ppvObj: MUST be set to reference an existing instance of the coclass described by the ITypeInfo server, if the coclass was declared with the [predeclid] or [appobject] attributes and an instance of the coclass exists. MUST be set to NULL if the coclass was declared with the [noncreatable] attribute. Otherwise, MUST be set to a new instance of the coclass described by the ITypeInfo server or NULL if the class cannot be instantiated.
Return Values: The method MUST return information in an HRESULT data structure, defined in [MS-ERREF] section 2.1. The severity bit in the structure identifies the following conditions:
If the severity bit is set to 0, the method completed successfully.
If the severity bit is set to 1 and the entire HRESULT DWORD does not match a value in the following table, a fatal failure occurred.
If the severity bit is set to 1 and the entire HRESULT DWORD matches a value in the following table, a failure occurred.
Return value/code
Description
0x80000004
TYPE_E_NOINTERFACE
The value of riid did not specify a known type. See [MS-ERREF].
0x800288BD
TYPE_E_BADMODULEKIND
The ITypeInfo server specified a non-coclass type. See [MS-ERREF].