3.5.4.1 ITypeComp::Bind (Opnum 3)

The Bind method retrieves automation type description server instances and related structures that provide access to a method, property or data member whose name corresponds to a specified string.

 HRESULT Bind(
   [in] LPOLESTR szName,
   [in] ULONG lHashVal,
   [in] WORD wFlags,
   [out] ITypeInfo** ppTInfo,
   [out] DESCKIND* pDescKind,
   [out] LPFUNCDESC* ppFuncDesc,
   [out] LPVARDESC* ppVarDesc,
   [out] ITypeComp** ppTypeComp,
   [out] DWORD* pReserved
 );

szName: MUST be set to a string.

lHashVal: MUST be set to the hash value that corresponds to the value of szName (as specified in section 2.2.51) or 0. Whether 0 or a computed hash value is specified for this argument, the server MUST return the same values in ppTInfo, pDescKind, ppFuncDesc, ppVarDesc, and ppTypeComp.

wFlags: MUST be set to a value of the INVOKEKIND enumeration, as specified in section 2.2.14, or 0.

ppTInfo: MUST be set to a reference to the ITypeInfo server instance that corresponds to the element whose name matches the value of szName or NULL, as specified in sections 3.5.4.1.2 and 2.2.50. MUST be set to NULL if szName does not match the name of any element in the binding context (see section 3.5.4.1.1).

pDescKind: MUST be set to one of the following values of the DESCKIND enumeration (section 2.2.22):

  • MUST be set to DESCKIND_FUNCDESC if the values of szName and wFlags specify a method or property accessor method in the binding context of the ITypeComp server.

  • MUST be set to DESCKIND_VARDESC if the values of szName and wFlags specify a data member of an enumeration, module, or ODL dispinterface in the binding context of the ITypeComp server, or if the binding server is an ITypeLib server and szName specifies the name of an appobject coclass in the binding context of the ITypeComp server.

  • MUST be set to DESCKIND_TYPECOMP if the value of szName specifies an enumeration or module in the binding context of the ITypeComp server.

  • MUST be set to DESCKIND_IMPLICITAPPOBJ if the binding server is an ITypeLib server, the value of szName specifies an element in the binding context of an appobject coclass, and the appobject coclass is in the binding context of the ITypeComp server.

  •  Otherwise, MUST be set to DESCKIND_NONE.

ppFuncDesc: MUST be set to a FUNCDESC that describes the method or property whose name matches the value of szName, if pDescKind is DESCKIND_FUNCDESC. Otherwise, MUST be set to NULL.

ppVarDesc: MUST be set to a value that is specified by the value of pDescKind.

  • DESCKIND_VARDESC: MUST be set to a VARDESC that describes a data member of an enumeration, module, or ODL dispinterface if the name of the data member matches szName.

  • DESCKIND_IMPLICITAPPOBJ: MUST be set to a VARDESC that describes the appobject coclass whose binding context contains a member whose name matches szName.

  • DESCKIND_FUNCDESC, DESCKIND_TYPECOMP, DESCKIND_NONE: MUST be set to NULL.

ppTypeComp: MUST be set to a reference to an ITypeComp server instance that provides access to the binding context of the bound element, if pDescKind is DESCKIND_TYPECOMP or DESCKIND_IMPLICITAPPOBJ. Otherwise, MUST be set to NULL.

pReserved: MUST be set to 0.

Return Values: The method MUST return information in an HRESULT data structure, which is 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

    0x8002802C

    TYPE_E_AMBIGUOUSNAME

    The values of szName and wFlags match more than one element in the binding context. See [MS-ERREF].

    0x80028CA0

    TYPE_E_TYPEMISMATCH

    The value of szName matched a single element in the binding context, but the INVOKEKIND value that is associated with that element did not match the value of wFlags. See [MS-ERREF].