IDispatchEx::GetDispIDIDispatchEx::GetDispID*
*Contents  *Index  *Topic Contents
*Previous Topic: IDispatchEx::DeleteMemberByName
*Next Topic: IDispatchEx::GetMemberName

IDispatchEx::GetDispID

 HRESULT GetDispID(
   BSTR bstrName,
   DWORD grfdex,
   DISPID *pid
);

Maps a single member name to its corresponding DISPID, which can then be used on subsequent calls to IDispatchEx::InvokeEx.

bstrName
Passed in name to be mapped.
grfdex
Determines the options for obtaining the member identifier. This can be a combination of the following values:
fdexNameCaseSensitive Request that the name lookup be done in a case-sensitive manner. May be ignored by object that does not support case-sensitive lookup.
fdexNameEnsure Request that the member be created if it does not already exist. The new member should be created with the value VT_EMPTY.
fdexNameImplicit Indicates that the caller is searching object(s) for a member of a particular name, when the base object is not explicitly specified.
fdexNameCaseInsensitive Request that the name lookup be done in a case-insensitive manner. May be ignored by object that does not support case-insensitive lookup.
pid
Pointer to caller-allocated location to receive DISPID result. If an error occurs, pid contains DISPID_UNKNOWN.

GetDispID can be used instead of GetIDsOfNames to obtain the DISPID for a given member.

Because IDispatchEx allows the addition and deletion of members, the set of DISPIDs does not remain constant for the lifetime of an object.

The unused riid parameter in IDispatch::GetIDsOfNames has been removed.

Example

BSTR bstrName;
   DISPID dispid;
   IDispatch *pdex; 

   // Assign to pdex and bstrName
   pdex->GetDispID(bstrName, fdexNameCaseSensitive, &dispid);
   // Use dispid

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.