Microsoft Windows Script Interfaces

IDispatchEx::GetNextDispID

Enumerates the members of the object.

HRESULT GetNextDispID(
   DWORD grfdex,
   DISPID id,
   DISPID *pid
);

Returns one of the following values:

S_OK Success.
S_FALSE Enumeration is done.

Parameters

grfdex
Determines which set of items will be enumerated. This can be a combination of the following values:
Value Meaning
fdexEnumDefault Requests that the object enumerates the default elements. The object is allowed to enumerate any set of elements.
fdexEnumAll Requests that the object enumerates all of the elements. The object is allowed to enumerate any set of elements.
id
Identifies the current member. GetNextDispID will retrieve the item in the enumeration after this one. Uses GetDispID or a previous call to GetNextDispID to obtain this identifier. Uses the DISPID_STARTENUM value to obtain the first identifier of the first item.
pid
Address of a DISPID variable that receives the identifier of the next item in the enumeration.

If a member is deleted by DeleteMemberByName or DeleteMemberByDispID, the DISPID needs to remain valid for GetNextDispID.

Example

HRESULT hr;
   BSTR bstrName;
   DISPID dispid;
   IDispatch *pdex;

   // Assign to pdex
   hr = pdex->GetNextDispID(fdexEnumAll, DISPID_STARTENUM, &dispid);
   while (hr != S_FALSE)
   {
      pdex->GetMemberName(dispid, &bstrName);
      if (!wcscmp(bstrName, OLESTR("Bar")))
      return TRUE;
      SysFreeString(bstrName);

      hr = pdexObj->GetNextDispID(fdexEnumAll, dispid, &dispid);
   }

See Also

IDispatchEx Interface | IDispatchEx::GetDispID | IDispatchEx::GetNextDispID | IDispatchEx::DeleteMemberByName | IDispatchEx::DeleteMemberByDispID