IDispatchEx::GetMemberName

Retrieves the name of a member.

Syntax

HRESULT GetMemberName(  
   DISPID id,  
   BSTR *pbstrName  
);  

Parameters

id
Identifies the member. Uses GetDispID or GetNextDispID to obtain the dispatch identifier.

pbstrName
Address of a BSTR that receives the name of the member. The calling application is responsible for freeing this value.

Return Value

Returns one of the following values:

S_OK Success.
DISP_E_UNKNOWNNAME The name was not known.

Example

HRESULT hr;  
   BSTR bstrName;  
   DISPID dispid;  
   IDispatchEx *pdex;  
  
   // Assign to pdex  
   hr = pdex->GetNextDispID(fdexEnumAll, DISPID_STARTENUM, &dispid);  
   while (hr == NOERROR)  
   {  
      hr = pdex->GetMemberName(dispid, &bstrName);  
      if (!wcscmp(bstrName, OLESTR("Bar")))  
      {  
         SysFreeString(bstrName);  
         return TRUE;  
      }  
   SysFreeString(bstrName);  
   hr = pdex->GetNextDispID(fdexEnumAll, dispid, &dispid);  
   }  

See also

IDispatchEx Interface
IDispatchEx::GetDispID
IDispatchEx::GetNextDispID