Partager via


3.7.4.5 ITypeInfo::GetNames (Opnum 7)

The GetNames method retrieves the data member name or the method and parameter names associated with a specified MEMBERID.

 HRESULT GetNames(
   [in] MEMBERID memid,
   [out, size_is(cMaxNames), length_is(*pcNames)] 
     BSTR* rgBstrNames,
   [in] UINT cMaxNames,
   [out] UINT* pcNames
 );

memid: MUST be a MEMBERID (section 2.2.35).

rgBstrNames: MUST be set to an array of BSTR. If pcNames is 0, rgBstrNames MUST be NULL.

cMaxNames: MUST specify the maximum length of the rgBstrNames array that the client can accept.

pcNames: MUST be set to the length of the rgBstrNames array.

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

    0x8002802B

    TYPE_E_ELEMENTNOTFOUND

    The value of memid did not specify the MEMBERID of a member of the type. See [MS-ERREF].

If the memid field corresponds to multiple property accessor methods, the contents of rgBstrNames MUST correspond to the [propget] property accessor.

If the ITypeInfo server represents an appobject coclass (see section 2.2.49.8) and memid is MEMBERID_DEFAULTINST, the first element of rgBstrNames MUST be set to the name of the coclass.

In all other cases, the first element of rgBstrNames MUST be set to the name of the method or data element in the binding context of the ITypeInfo server that corresponds to the value of memid.

If memid specifies a method or property accessor method, the remaining elements of rgBstrNames MUST be set to the names of entries in its parameter table, in the order in which they are stored in the parameter table.

If memid specifies a put or putref property, the rgBstrNames array MUST NOT include the name of the [retval] parameter. If memid specifies a member of a dispinterface, the rgBstrNames array MUST NOT include the names of [lcid] or [retval] parameters (see section 3.1.4.4). In all other cases, the rgBstrNames array MUST include all members of the parameter table.